I'm able to obtain Github api token in python using username and password but i'm not able to use that API-Token for requesting any POST/DELETE/PATCH.
How do we use Github API-Tokens for making any request. For eg, i have API-Token lets say 'hbnajkjanjknjknh23b2jk2kj2jnkl2...'
now for requesting
#i'm providing username and API-Token in headers like
self.header = {'X-Github-Username': self.username,
'X-Github-API-Token': self.api_token
}
#then requesting(post) to create a gist
r = requests.post(url, headers=headers)
But i'm always getting 401 error with Bad Crediantials message.
What's the proper way to use API-Tokens without inputting the password
requests.post(....,auth=api_token)instead ofauth=(username,password)