Download our e-book of Introduction To Python
Shashank Shanu
3 years ago
import requests
req = requests.get('https://api.github.com/user', auth=('user', 'pass'))
print(req)
import requests
from requests_oauthlib import OAuth1
url = 'https://api.twitter.com/1.1/account/verify_credentials.json'
auth = OAuth1('YOUR_APP_KEY', 'YOUR_APP_SECRET',
'USER_OAUTH_TOKEN', 'USER_OAUTH_TOKEN_SECRET')
requests.get(url, auth=auth)
{
"errors": [
{
"code": 215,
"message": "Bad Authentication data."
}
]
}