Skip to content
Myr

Update auth documentation with org info.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Cory Benfield · committed by Cory Benfield · parent 9bb332f · Browse files · 1 file+16 added−34 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+16 added−34 removed

  • other:+16 added−34 removed

1 file+16 added−34 removed

modified:docs/user/quickstart.rst+16 added-34 removed
368 unmodified lines
369 >>> requests.get(url, auth=HTTPDigestAuth('user', 'pass'))370 <Response [200]>371372373OAuth Authentication373Other Authentication374--------------------375376Requests features robust, built-in OAuth support!376Requests is designed to allow other forms of authentication to be easily and377quickly plugged in. Members of the open-source community frequently write378authentication handlers for more complicated or less commonly-used forms of379authentication. Some of the best have been brought together under a single380`organization on Github`_, including:381378OAuth takes many forms, so let's take a look at a few different forms::382- OAuth_383- Kerberos_384- NTLM_385380 import requests381 from requests.auth import OAuth1386If you want to use any of these forms of authentication, go straight to their387Github page and follow the instructions. If you can't find the one you want,388why not write one and submit it?389383 url = u'https://api.twitter.com/1/account/settings.json'390.. _OAuth: https://github.com/requests/requests-oauthlib391.. _Kerberos: https://github.com/requests/requests-kerberos392.. _NTLM: https://github.com/requests/requests-ntlm393.. _organisation on Github: https://github.com/requests394385 client_key = u'...'386 client_secret = u'...'387 resource_owner_key = u'...'388 resource_owner_secret = u'...'395390391Query signing::392393 queryoauth = OAuth1(client_key, client_secret,394 resource_owner_key, resource_owner_secret,395 signature_type='query')396 r = requests.get(url, auth=queryoauth)397398Header signing::399400 headeroauth = OAuth1(client_key, client_secret,401 resource_owner_key, resource_owner_secret,402 signature_type='auth_header')403 r = requests.get(url, auth=headeroauth)404405Body signing::406407 bodyoauth = OAuth1(client_key, client_secret,408 resource_owner_key, resource_owner_secret,409 signature_type='body')410411 r = requests.post(url, auth=bodyoauth)412413396Redirection and History397-----------------------398399Requests will automatically perform location redirection while using the GET
78 unmodified lines