Python input function length limit

Viewed 227

I want to use the input function in python3 to ask the user a jwt token.

Unfortunately, I'm reaching the length limit of this function (I think).

The length of my jwt token is 1130 characters

When I'm pasting my token into the input, I'm facing a blocker and its truncated.

Do you see any workaround or another way to do this ?

    # if config is empty, load using input() functions
    if not cdp_token:
        cdp_token = input("Token JWT Empty! Please Enter your cdh api token (https://mysite/profile):\n")
1 Answers

You can use concept of hashing. Try hashing your token to something small, may be using SHA or any standard algorithm. When you check the token from database/repository you can hash that db token as well and compare it in your function. I think this can be a good approach.

Related