Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install requests-oauthlib

How to install requests-oauthlib

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install requests-oauthlib
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
0.3.3 Available View build log
Windows (64-bit)
0.3.3 Available View build log
Mac OS X (10.5+)
0.3.3 Available View build log
0.3.2 Available View build log
0.3.1 Available View build log
Linux (32-bit)
0.3.3 Available View build log
0.3.2 Available View build log
Linux (64-bit)
0.3.3 Available View build log
0.3.2 Available View build log
0.3.1 Available View build log
0.2.0 Available View build log
0.3.3 Available View build log
0.3.1 Available View build log
 
Author
License
ISC
Lastest release
version 0.3.3 on Aug 12th, 2013

This project provides first-class OAuth library support for Requests.

The OAuth 1 workflow

OAuth 1 can seem overly complicated and it sure has its quirks. Luckily, requests_oauthlib hides most of these and let you focus at the task at hand.

Accessing protected resources using requests_oauthlib is as simple as:

System Message: ERROR/3 (<string>, line 14)

Unknown directive type "code-block".

.. code-block:: pycon

    >>> from requests_oauthlib import OAuth1Session
    >>> twitter = OAuth1Session('client_key',
                                client_secret='client_secret',
                                resource_owner_key='resource_owner_key',
                                resource_owner_secret='resource_owner_secret')
    >>> url = 'https://api.twitter.com/1/account/settings.json'
    >>> r = twitter.get(url)

Before accessing resources you will need to obtain a few credentials from your provider (i.e. Twitter) and authorization from the user for whom you wish to retrieve resources for. You can read all about this in the full OAuth 1 workflow guide on RTD.

The OAuth 2 workflow

OAuth 2 is generally simpler than OAuth 1 but comes in more flavours. The most common being the Authorization Code Grant, also known as the WebApplication flow.

Fetching a protected resource after obtaining an access token can be as simple as:

System Message: ERROR/3 (<string>, line 38)

Unknown directive type "code-block".

.. code-block:: pycon

    >>> from requests_oauthlib import OAuth2Session
    >>> google = OAuth2Session(r'client_id', token=r'token')
    >>> url = 'https://www.googleapis.com/oauth2/v1/userinfo'
    >>> r = google.get(url)

Before accessing resources you will need to obtain a few credentials from your provider (i.e. Google) and authorization from the user for whom you wish to retrieve resources for. You can read all about this in the full OAuth 2 workflow guide on RTD.

Installation

To install requests and requests_oauthlib you can use pip:

System Message: ERROR/3 (<string>, line 55)

Unknown directive type "code-block".

.. code-block:: bash

    $ pip install requests requests_oauthlib

Subscribe to package updates

Last updated Aug 12th, 2013

Download Stats

Last month:5

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.