token

Discord Bot Python missing positional argument token

Discord Bot Python missing positional argument token Question: I’m a beginner python programmer trying to get my bot online, but I can’t solve one error I keep getting. In tutorials, people usually run something like client.run(‘TOKEN’) in the end, whereas TOKEN is the discord bot token. Pycharm doesn’t recognize the token and gives the following …

Total answers: 3

How to increase count if function called by another function in Python

How to increase count if function called by another function in Python Question: I am trying to count all tokens given by func1 and print out the result from func2. The problem is that each time func2 gets called the counter does not update for natural reasons because we call the function over and over …

Total answers: 2

Authorization missing error when using the token as header using python requests module

Authorization missing error when using the token as header using python requests module Question: Trying to convert curl below to the Python requests, below is the curl command which is working fine. curl -k -H "Authorization: Token token="$token""https://conjur.com/secret Above curl works fine and gives expected output but when I turn that into python requests it …

Total answers: 1

Handling the token expiration in fastapi

Handling the token expiration in fastapi Question: I’m new with fastapi security and I’m trying to implement the authentication thing and then use scopes. The problem is that I’m setting an expiration time for the token but after the expiration time the user still authenticated and can access services import json from jose import jwt,JWTError …

Total answers: 5

Spotipy 401 / 405 No token provided

Spotipy 401 / 405 No token provided Question: I have been working on a Spotify / Spotipy application which will add the current song to a certain playlist. My functions for getting the current song and showing a playlist are all doing fine. My function for adding a song to a playlist is not. I …

Total answers: 1

Creating Dictionary and Integer Key for List of Strings in Python

Creating Dictionary and Integer Key for List of Strings in Python Question: I have a list of unicode string lists. Each string list represents a different document with the strings representing the authors’ names. Some documents have only one author while other documents can have multiple co-authors. For example, a sample of authorship of three …

Total answers: 3

Should I use JWT or Basic Token authentication in Django Rest Framework?

Should I use JWT or Basic Token authentication in Django Rest Framework? Question: I’m about to implement Token Authentication in my API using Django Rest Framework. But I’m not sure if I should use the basic token build-in DRF or use the JSON Web Token (JWT) standard (using this package djangorestframework-jwt) The only reference that …

Total answers: 2

Python requests library how to pass Authorization header with single token

Python requests library how to pass Authorization header with single token Question: I have a request URI and a token. If I use: curl -s “<MY_URI>” -H “Authorization: TOK:<MY_TOKEN>” etc., I get a 200 and view the corresponding JSON data. So, I installed requests and when I attempt to access this resource I get a …

Total answers: 9