diff -Nru python-requests-oauthlib-0.8.0/debian/changelog python-requests-oauthlib-1.0.0/debian/changelog --- python-requests-oauthlib-0.8.0/debian/changelog 2017-09-09 08:01:27.000000000 +0000 +++ python-requests-oauthlib-1.0.0/debian/changelog 2019-01-07 11:56:36.000000000 +0000 @@ -1,10 +1,33 @@ +python-requests-oauthlib (1.0.0-0.1) unstable; urgency=medium + + * Non-maintainer upload + * New upstream version 1.0.0 + * debian/control + - Bumps debhelper version to 12 + - Adds new missing build dependencies + - Updates standards version to 4.3.0 + - Adds build dependency on dh-python + - Updates test suite + - Removes trailing whitespaces + - Adds dependency on python3-sphinx + - Updates VCS fields + * debian/watch + - Fixes insecure URI in debian/watch + * debian/rules + - Updates build system to pybuild + - Excludes networked tests + * debian/doc-base + - Updates path to docs + + -- Ana Custura Mon, 07 Jan 2019 11:56:36 +0000 + python-requests-oauthlib (0.8.0-0.1) unstable; urgency=medium * Non-maintainer upload * New upstream version 0.8.0 * debian/control - Updates VCS links - - Removes unnecessary versioned dependencies + - Removes unnecessary versioned dependencies - Updates standards version to 4.1.0 * debian/copyright - Updates format link to use https diff -Nru python-requests-oauthlib-0.8.0/debian/compat python-requests-oauthlib-1.0.0/debian/compat --- python-requests-oauthlib-0.8.0/debian/compat 2017-09-09 07:45:33.000000000 +0000 +++ python-requests-oauthlib-1.0.0/debian/compat 2019-01-06 23:26:46.000000000 +0000 @@ -1 +1 @@ -9 +12 diff -Nru python-requests-oauthlib-0.8.0/debian/control python-requests-oauthlib-1.0.0/debian/control --- python-requests-oauthlib-0.8.0/debian/control 2017-09-09 07:57:41.000000000 +0000 +++ python-requests-oauthlib-1.0.0/debian/control 2019-01-07 11:52:21.000000000 +0000 @@ -2,24 +2,34 @@ Maintainer: Simon Fondrie-Teitler Section: python Priority: optional -Build-Depends: debhelper (>= 9), +Build-Depends: debhelper (>= 12), python-all, python-setuptools, + python-pytest, python3-all, + dh-python, python3-setuptools, python-requests, python-oauthlib, python-sphinx, + python3-sphinx, + python-requests-mock, + python-mock, + python3-requests, + python3-pytest, + python3-requests-mock, + python3-mock, + python3-oauthlib, Homepage: https://github.com/requests/requests-oauthlib -Standards-Version: 4.1.0 -Vcs-Browser: https://anonscm.debian.org/cgit/collab-maint/python-requests-oauthlib.git -Vcs-Git: https://anonscm.debian.org/git/collab-maint/python-requests-oauthlib.git +Standards-Version: 4.3.0 +Vcs-Browser: https://salsa.debian.org/simonft-guest/python-requests-oauthlib +Vcs-Git: https://salsa.debian.org/simonft-guest/python-requests-oauthlib.git Package: python-requests-oauthlib Architecture: all -Depends: ${misc:Depends}, - ${python:Depends}, - python-requests, +Depends: ${misc:Depends}, + ${python:Depends}, + python-requests, python-oauthlib Description: module providing OAuthlib auth support for requests (Python 2) requests-oauthlib allows you to interact with OAuth 1 And OAuth 2 in @@ -32,9 +42,9 @@ Package: python3-requests-oauthlib Architecture: all -Depends: ${misc:Depends}, - ${python3:Depends}, - python3-requests, +Depends: ${misc:Depends}, + ${python3:Depends}, + python3-requests, python3-oauthlib Description: module providing OAuthlib auth support for requests (Python 3) requests-oauthlib allows you to interact with OAuth 1 And OAuth 2 in @@ -48,7 +58,7 @@ Package: python-requests-oauthlib-doc Architecture: all Section: doc -Depends: ${sphinxdoc:Depends}, +Depends: ${sphinxdoc:Depends}, ${misc:Depends}, Description: module providing OAuthlib auth support for requests (Common Documentation) requests-oauthlib allows you to interact with OAuth 1 And OAuth 2 in @@ -58,5 +68,3 @@ . This package provides the common documentation for the requests-oauthlib Python module. - - diff -Nru python-requests-oauthlib-0.8.0/debian/python-requests-oauthlib-doc.doc-base python-requests-oauthlib-1.0.0/debian/python-requests-oauthlib-doc.doc-base --- python-requests-oauthlib-0.8.0/debian/python-requests-oauthlib-doc.doc-base 2017-09-09 07:45:33.000000000 +0000 +++ python-requests-oauthlib-1.0.0/debian/python-requests-oauthlib-doc.doc-base 2019-01-07 11:43:33.000000000 +0000 @@ -5,5 +5,5 @@ Section: Programming/Python Format: HTML -Index: /usr/share/doc/python-requests-oauthlib-doc/html/index.html -Files: /usr/share/doc/python-requests-oauthlib-doc/html/ +Index: /usr/share/doc/python-requests-oauthlib/html/index.html +Files: /usr/share/doc/python-requests-oauthlib/html/ diff -Nru python-requests-oauthlib-0.8.0/debian/rules python-requests-oauthlib-1.0.0/debian/rules --- python-requests-oauthlib-0.8.0/debian/rules 2017-09-09 07:45:33.000000000 +0000 +++ python-requests-oauthlib-1.0.0/debian/rules 2019-01-07 11:13:16.000000000 +0000 @@ -1,12 +1,12 @@ #!/usr/bin/make -f PYTHONS:=$(shell pyversions -vr) PYTHON3S:=$(shell py3versions -vr) - +export PYBUILD_TEST_ARGS= tests/ -k "not testCanPostBinaryData and not test_content_type_override and not test_url_is_native_str" %: - dh $@ --buildsystem=python_distutils --with python2,python3,sphinxdoc + dh $@ --buildsystem=pybuild --with python2,python3,sphinxdoc override_dh_clean: - dh_clean -O--buildsystem=python_distutils + dh_clean -O--buildsystem=pybuild rm -rf build requests-oauthlib.egg-info rm -rf docs/_build/ diff -Nru python-requests-oauthlib-0.8.0/debian/watch python-requests-oauthlib-1.0.0/debian/watch --- python-requests-oauthlib-0.8.0/debian/watch 2017-09-09 07:45:33.000000000 +0000 +++ python-requests-oauthlib-1.0.0/debian/watch 2019-01-06 23:28:28.000000000 +0000 @@ -1,3 +1,3 @@ version=3 opts=dversionmangle=s/\+dfsg\d+$// \ -http://pypi.python.org/packages/source/r/requests-oauthlib/ requests-oauthlib-(.+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz))) +https://pypi.python.org/packages/source/r/requests-oauthlib/ requests-oauthlib-(.+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz))) diff -Nru python-requests-oauthlib-0.8.0/docs/conf.py python-requests-oauthlib-1.0.0/docs/conf.py --- python-requests-oauthlib-0.8.0/docs/conf.py 2014-10-16 17:20:22.000000000 +0000 +++ python-requests-oauthlib-1.0.0/docs/conf.py 2018-06-04 09:05:28.000000000 +0000 @@ -251,7 +251,7 @@ # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = { - 'python': ('http://python.readthedocs.org/en/latest/', None), - 'requests': ('http://requests.readthedocs.org/en/latest/', None), - 'oauthlib': ('http://oauthlib.readthedocs.org/en/latest/', None), + 'python': ('https://python.readthedocs.io/en/latest/', None), + 'requests': ('https://requests.readthedocs.io/en/latest/', None), + 'oauthlib': ('https://oauthlib.readthedocs.io/en/latest/', None), } diff -Nru python-requests-oauthlib-0.8.0/docs/examples/examples.rst python-requests-oauthlib-1.0.0/docs/examples/examples.rst --- python-requests-oauthlib-0.8.0/docs/examples/examples.rst 2016-10-14 10:12:16.000000000 +0000 +++ python-requests-oauthlib-1.0.0/docs/examples/examples.rst 2018-04-10 21:27:47.000000000 +0000 @@ -8,6 +8,7 @@ github google facebook + fitbit linkedin outlook tumblr diff -Nru python-requests-oauthlib-0.8.0/docs/examples/fitbit.rst python-requests-oauthlib-1.0.0/docs/examples/fitbit.rst --- python-requests-oauthlib-0.8.0/docs/examples/fitbit.rst 1970-01-01 00:00:00.000000000 +0000 +++ python-requests-oauthlib-1.0.0/docs/examples/fitbit.rst 2018-04-10 21:27:47.000000000 +0000 @@ -0,0 +1,40 @@ +.. _fitbit: + +Fitbit OAuth 2 (Mobile Application Flow) Tutorial +================================================= + +This makes use of the Implicit Grant Flow to obtain an access token for the `Fitbit API`_. Register a new client application there with a callback URL, and have your client ID handy. Based on an `another example`_ of the Mobile Application Flow. + +.. _`Fitbit API`: https://dev.fitbit.com/ +.. _`another example`: https://github.com/requests/requests-oauthlib/issues/104 + +.. code-block:: pycon + + >>> import requests + >>> from requests_oauthlib import OAuth2Session + >>> from oauthlib.oauth2 import MobileApplicationClient + + # Set up your client ID and scope: the scope must match that which you requested when you set up your application. + >>> client_id = "" + >>> scope = ["activity", "heartrate", "location", "nutrition", "profile", "settings", "sleep", "social", "weight"] + + # Initialize client + >>> client = MobileApplicationClient(client_id) + >>> fitbit = OAuth2Session(client_id, client=client, scope=scope) + >>> authorization_url = "https://www.fitbit.com/oauth2/authorize" + + # Grab the URL for Fitbit's authorization page. + >>> auth_url, state = fitbit.authorization_url(authorization_url) + >>> print("Visit this page in your browser: {}".format(auth_url)) + + # After authenticating, Fitbit will redirect you to the URL you specified in your application settings. It contains the access token. + >>> callback_url = input("Paste URL you get back here: ") + + # Now we extract the token from the URL to make use of it. + >>> fitbit.token_from_fragment(callback_url) + + # We can also store the token for use later. + >>> token = fitbit['token'] + + # At this point, assuming nothing blew up, we can make calls to the API as normal, for example: + >>> r = fitbit.get('https://api.fitbit.com/1/user/-/sleep/goal.json') diff -Nru python-requests-oauthlib-0.8.0/docs/examples/google.rst python-requests-oauthlib-1.0.0/docs/examples/google.rst --- python-requests-oauthlib-0.8.0/docs/examples/google.rst 2016-09-18 08:55:08.000000000 +0000 +++ python-requests-oauthlib-1.0.0/docs/examples/google.rst 2018-04-10 21:27:47.000000000 +0000 @@ -29,7 +29,7 @@ >>> authorization_url, state = google.authorization_url(authorization_base_url, ... # offline for refresh token ... # force to always make user click authorize - ... access_type="offline", approval_prompt="force") + ... access_type="offline", prompt="select_account") >>> print 'Please go here and authorize,', authorization_url >>> # Get the authorization verifier code from the callback url diff -Nru python-requests-oauthlib-0.8.0/docs/examples/real_world_example.rst python-requests-oauthlib-1.0.0/docs/examples/real_world_example.rst --- python-requests-oauthlib-0.8.0/docs/examples/real_world_example.rst 2015-12-14 11:12:34.000000000 +0000 +++ python-requests-oauthlib-1.0.0/docs/examples/real_world_example.rst 2018-06-04 09:05:28.000000000 +0000 @@ -80,7 +80,7 @@ if __name__ == "__main__": # This allows us to use a plain HTTP callback - os.environ['DEBUG'] = "1" + os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = "1" app.secret_key = os.urandom(24) app.run(debug=True) diff -Nru python-requests-oauthlib-0.8.0/docs/examples/real_world_example_with_refresh.rst python-requests-oauthlib-1.0.0/docs/examples/real_world_example_with_refresh.rst --- python-requests-oauthlib-0.8.0/docs/examples/real_world_example_with_refresh.rst 2014-06-06 13:18:24.000000000 +0000 +++ python-requests-oauthlib-1.0.0/docs/examples/real_world_example_with_refresh.rst 2018-06-04 09:05:28.000000000 +0000 @@ -58,7 +58,7 @@ authorization_url, state = google.authorization_url(authorization_base_url, # offline for refresh token # force to always make user click authorize - access_type="offline", approval_prompt="force") + access_type="offline", prompt="select_account") # State is used to prevent CSRF, keep this for later. session['oauth_state'] = state @@ -175,7 +175,7 @@ if __name__ == "__main__": # This allows us to use a plain HTTP callback import os - os.environ['DEBUG'] = "1" + os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = "1" app.secret_key = os.urandom(24) app.run(debug=True) diff -Nru python-requests-oauthlib-0.8.0/docs/examples/wso2.rst python-requests-oauthlib-1.0.0/docs/examples/wso2.rst --- python-requests-oauthlib-0.8.0/docs/examples/wso2.rst 1970-01-01 00:00:00.000000000 +0000 +++ python-requests-oauthlib-1.0.0/docs/examples/wso2.rst 2018-04-10 21:27:47.000000000 +0000 @@ -0,0 +1,31 @@ +WSO2 OAuth 2 Tutorial +========================== + +Setup subscriptions following the instructions on your WSO2 gateway. When you +have obtained a ``client_id`` and a ``client_secret`` you can try out the +command line interactive example below. + + +.. code-block:: pycon + + >>> from requests.auth import HTTPBasicAuth + >>> from oauthlib.oauth2 import BackendApplicationClient + >>> from requests_oauthlib import OAuth2Session + + >>> #grab client_id and client_secret: + >>> client_id = u'' + >>> client_secret = u'' + >>> token_url = 'https://wso2gateway.myorg.org/token' + + >>> #generate HTTPBasicAuth Header + >>> basic_auth = HTTPBasicAuth(client_id, client_secret) + >>> client = BackendApplicationClient(client_id=client_id) + + >>> #start oauth session + >>> oauth = OAuth2Session(client=client) + >>> token = oauth.fetch_token(token_url=token_url, + auth=basic_auth) + + >>> r = oauth.get(u'https://wso2gateway.myorg.org/api/v1/api', + >>> headers={'Accept':'application/json'}) + >>> print(r.json()) diff -Nru python-requests-oauthlib-0.8.0/docs/oauth2_workflow.rst python-requests-oauthlib-1.0.0/docs/oauth2_workflow.rst --- python-requests-oauthlib-0.8.0/docs/oauth2_workflow.rst 2015-11-09 09:08:43.000000000 +0000 +++ python-requests-oauthlib-1.0.0/docs/oauth2_workflow.rst 2018-04-10 21:27:47.000000000 +0000 @@ -68,9 +68,9 @@ scope=scope) >>> authorization_url, state = oauth.authorization_url( 'https://accounts.google.com/o/oauth2/auth', - # access_type and approval_prompt are Google specific extra + # access_type and prompt are Google specific extra # parameters. - access_type="offline", approval_prompt="force") + access_type="offline", prompt="select_account") >>> print 'Please go to %s and authorize access.' % authorization_url >>> authorization_response = raw_input('Enter the full callback URL') @@ -101,7 +101,31 @@ Mobile Application Flow ----------------------- -Documentation coming soon. Want to help? Why not `write this section`_? +The steps below outline how to use the Implicit Code Grant Type flow to obtain an access token. + +0. You will need the following settings. + +.. code-block:: pycon + + >>> client_id = 'your_client_id' + >>> scopes = ['scope_1', 'scope_2'] + >>> auth_url = 'https://your.oauth2/auth' + +1. Get the authorization_url + +.. code-block:: pycon + + >>> from oauthlib.oauth2 import MobileApplicationClient + >>> from requests_oauthlib import OAuth2Session + >>> oauth = OAuth2Session(client=MobileApplicationClient(client_id=client_id), scope=scopes) + >>> authorization_url, state = oauth.authorization_url(auth_url) + +2. Fetch an access token from the provider. + +.. code-block:: pycon + + >>> response = oauth.get(authorization_url) + >>> oauth.token_from_fragment(response.url) .. _legacy-application-flow: @@ -139,23 +163,33 @@ The steps below outline how to use the Resource Owner Client Credentials Grant Type flow to obtain an access token. 0. Obtain credentials from your OAuth provider. At minimum you will - need a ``client_id`` and ``client_secret``. + need a ``client_id`` and ``client_secret``. -.. code-block:: pycon + .. code-block:: pycon - >>> client_id = 'your_client_id' - >>> client_secret = 'your_client_secret' + >>> client_id = 'your_client_id' + >>> client_secret = 'your_client_secret' 1. Fetch an access token from the provider. -.. code-block:: pycon - - >>> from oauthlib.oauth2 import BackendApplicationClient - >>> client = BackendApplicationClient(client_id=client_id) - >>> oauth = OAuth2Session(client=client) - >>> token = oauth.fetch_token(token_url='https://provider.com/oauth2/token', client_id=client_id, - client_secret=client_secret) + .. code-block:: pycon + >>> from oauthlib.oauth2 import BackendApplicationClient + >>> client = BackendApplicationClient(client_id=client_id) + >>> oauth = OAuth2Session(client=client) + >>> token = oauth.fetch_token(token_url='https://provider.com/oauth2/token', client_id=client_id, + client_secret=client_secret) + + If your provider requires that you pass auth credentials in a Basic Auth header, you can do this instead: + + .. code-block:: pycon + + >>> from oauthlib.oauth2 import BackendApplicationClient + >>> from requests.auth import HTTPBasicAuth + >>> auth = HTTPBasicAuth(client_id, client_secret) + >>> client = BackendApplicationClient(client_id=client_id) + >>> oauth = OAuth2Session(client=client) + >>> token = oauth.fetch_token(token_url='https://provider.com/oauth2/token', auth=auth) Refreshing tokens ----------------- diff -Nru python-requests-oauthlib-0.8.0/HISTORY.rst python-requests-oauthlib-1.0.0/HISTORY.rst --- python-requests-oauthlib-0.8.0/HISTORY.rst 2017-02-14 15:15:05.000000000 +0000 +++ python-requests-oauthlib-1.0.0/HISTORY.rst 2018-06-04 09:10:22.000000000 +0000 @@ -1,6 +1,21 @@ History ------- +UNRELEASED +++++++++++ + +nothing yet + +v1.0.0 (4 June 2018) +++++++++++++++++++++ + +- **Removed support for Python 2.6 and Python 3.3.** + This project now supports Python 2.7, and Python 3.4 and above. +- Added several examples to the documentation. +- Added plentymarkets compliance fix. +- Added a ``token`` property to OAuth1Session, to match the corresponding + ``token`` property on OAuth2Session. + v0.8.0 (14 February 2017) +++++++++++++++++++++++++ diff -Nru python-requests-oauthlib-0.8.0/PKG-INFO python-requests-oauthlib-1.0.0/PKG-INFO --- python-requests-oauthlib-0.8.0/PKG-INFO 2017-02-14 15:17:00.000000000 +0000 +++ python-requests-oauthlib-1.0.0/PKG-INFO 2018-06-04 09:12:18.000000000 +0000 @@ -1,6 +1,6 @@ -Metadata-Version: 1.1 +Metadata-Version: 2.1 Name: requests-oauthlib -Version: 0.8.0 +Version: 1.0.0 Summary: OAuthlib authentication support for Requests. Home-page: https://github.com/requests/requests-oauthlib Author: Kenneth Reitz @@ -30,9 +30,9 @@ >>> 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 + provider (e.g. 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 `_. + `OAuth 1 workflow guide on RTD `_. The OAuth 2 workflow -------------------- @@ -43,9 +43,9 @@ Fetching a protected resource after obtaining an access token can be extremely simple. However, before accessing resources you will need to obtain a few - credentials from your provider (i.e. Google) and authorization from the user + credentials from your provider (e.g. 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 `_. + full `OAuth 2 workflow guide on RTD `_. Installation ------------- @@ -60,15 +60,30 @@ :target: https://travis-ci.org/requests/requests-oauthlib .. |coverage-status| image:: https://img.shields.io/coveralls/requests/requests-oauthlib.svg :target: https://coveralls.io/r/requests/requests-oauthlib - .. |docs| image:: https://readthedocs.org/projects/requests-oauthlib/badge/?version=latest + .. |docs| image:: https://readthedocs.org/projects/requests-oauthlib/badge/ :alt: Documentation Status :scale: 100% - :target: https://readthedocs.org/projects/requests-oauthlib/ + :target: https://requests-oauthlib.readthedocs.io/ History ------- + UNRELEASED + ++++++++++ + + nothing yet + + v1.0.0 (4 June 2018) + ++++++++++++++++++++ + + - **Removed support for Python 2.6 and Python 3.3.** + This project now supports Python 2.7, and Python 3.4 and above. + - Added several examples to the documentation. + - Added plentymarkets compliance fix. + - Added a ``token`` property to OAuth1Session, to match the corresponding + ``token`` property on OAuth2Session. + v0.8.0 (14 February 2017) +++++++++++++++++++++++++ @@ -172,8 +187,11 @@ Classifier: Natural Language :: English Classifier: License :: OSI Approved :: BSD License Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2.6 +Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 +Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 +Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.* +Provides-Extra: rsa diff -Nru python-requests-oauthlib-0.8.0/README.rst python-requests-oauthlib-1.0.0/README.rst --- python-requests-oauthlib-0.8.0/README.rst 2015-11-18 17:37:12.000000000 +0000 +++ python-requests-oauthlib-1.0.0/README.rst 2018-06-04 09:05:28.000000000 +0000 @@ -22,9 +22,9 @@ >>> 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 +provider (e.g. 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 `_. +`OAuth 1 workflow guide on RTD `_. The OAuth 2 workflow -------------------- @@ -35,9 +35,9 @@ Fetching a protected resource after obtaining an access token can be extremely simple. However, before accessing resources you will need to obtain a few -credentials from your provider (i.e. Google) and authorization from the user +credentials from your provider (e.g. 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 `_. +full `OAuth 2 workflow guide on RTD `_. Installation ------------- @@ -52,7 +52,7 @@ :target: https://travis-ci.org/requests/requests-oauthlib .. |coverage-status| image:: https://img.shields.io/coveralls/requests/requests-oauthlib.svg :target: https://coveralls.io/r/requests/requests-oauthlib -.. |docs| image:: https://readthedocs.org/projects/requests-oauthlib/badge/?version=latest +.. |docs| image:: https://readthedocs.org/projects/requests-oauthlib/badge/ :alt: Documentation Status :scale: 100% - :target: https://readthedocs.org/projects/requests-oauthlib/ + :target: https://requests-oauthlib.readthedocs.io/ diff -Nru python-requests-oauthlib-0.8.0/requests_oauthlib/compliance_fixes/__init__.py python-requests-oauthlib-1.0.0/requests_oauthlib/compliance_fixes/__init__.py --- python-requests-oauthlib-0.8.0/requests_oauthlib/compliance_fixes/__init__.py 2017-02-14 15:08:57.000000000 +0000 +++ python-requests-oauthlib-1.0.0/requests_oauthlib/compliance_fixes/__init__.py 2018-04-10 21:27:47.000000000 +0000 @@ -6,3 +6,4 @@ from .slack import slack_compliance_fix from .mailchimp import mailchimp_compliance_fix from .weibo import weibo_compliance_fix +from .plentymarkets import plentymarkets_compliance_fix diff -Nru python-requests-oauthlib-0.8.0/requests_oauthlib/compliance_fixes/plentymarkets.py python-requests-oauthlib-1.0.0/requests_oauthlib/compliance_fixes/plentymarkets.py --- python-requests-oauthlib-0.8.0/requests_oauthlib/compliance_fixes/plentymarkets.py 1970-01-01 00:00:00.000000000 +0000 +++ python-requests-oauthlib-1.0.0/requests_oauthlib/compliance_fixes/plentymarkets.py 2018-04-10 21:27:47.000000000 +0000 @@ -0,0 +1,27 @@ +from json import dumps, loads +import re + +from oauthlib.common import to_unicode + + +def plentymarkets_compliance_fix(session): + + def _to_snake_case(n): + return re.sub('(.)([A-Z][a-z]+)', r'\1_\2', n).lower() + + def _compliance_fix(r): + # Plenty returns the Token in CamelCase instead of _ + if 'application/json' in r.headers.get('content-type', {}) and r.status_code == 200: + token = loads(r.text) + else: + return r + + fixed_token = {} + for k, v in token.items(): + fixed_token[_to_snake_case(k)] = v + + r._content = to_unicode(dumps(fixed_token)).encode('UTF-8') + return r + + session.register_compliance_hook('access_token_response', _compliance_fix) + return session diff -Nru python-requests-oauthlib-0.8.0/requests_oauthlib/__init__.py python-requests-oauthlib-1.0.0/requests_oauthlib/__init__.py --- python-requests-oauthlib-0.8.0/requests_oauthlib/__init__.py 2017-02-14 15:15:35.000000000 +0000 +++ python-requests-oauthlib-1.0.0/requests_oauthlib/__init__.py 2018-06-04 09:09:55.000000000 +0000 @@ -1,9 +1,11 @@ +import logging + from .oauth1_auth import OAuth1 from .oauth1_session import OAuth1Session from .oauth2_auth import OAuth2 from .oauth2_session import OAuth2Session, TokenUpdated -__version__ = '0.8.0' +__version__ = '1.0.0' import requests if requests.__version__ < '2.0.0': @@ -11,12 +13,4 @@ 'requests-oauthlib expects, please upgrade to 2.0.0 or later.') raise Warning(msg % requests.__version__) -import logging -try: # Python 2.7+ - from logging import NullHandler -except ImportError: - class NullHandler(logging.Handler): - def emit(self, record): - pass - -logging.getLogger('requests_oauthlib').addHandler(NullHandler()) +logging.getLogger('requests_oauthlib').addHandler(logging.NullHandler()) diff -Nru python-requests-oauthlib-0.8.0/requests_oauthlib/oauth1_session.py python-requests-oauthlib-1.0.0/requests_oauthlib/oauth1_session.py --- python-requests-oauthlib-0.8.0/requests_oauthlib/oauth1_session.py 2016-10-14 10:12:16.000000000 +0000 +++ python-requests-oauthlib-1.0.0/requests_oauthlib/oauth1_session.py 2018-05-16 16:55:12.000000000 +0000 @@ -16,10 +16,6 @@ from . import OAuth1 -import sys -if sys.version > "3": - unicode = str - log = logging.getLogger(__name__) @@ -173,6 +169,26 @@ self.auth = self._client @property + def token(self): + oauth_token = self._client.client.resource_owner_key + oauth_token_secret = self._client.client.resource_owner_secret + oauth_verifier = self._client.client.verifier + + token_dict = {} + if oauth_token: + token_dict["oauth_token"] = oauth_token + if oauth_token_secret: + token_dict["oauth_token_secret"] = oauth_token_secret + if oauth_verifier: + token_dict["oauth_verifier"] = oauth_verifier + + return token_dict + + @token.setter + def token(self, value): + self._populate_attributes(value) + + @property def authorized(self): """Boolean that indicates whether this session has an OAuth token or not. If `self.authorized` is True, you can reasonably expect @@ -326,6 +342,7 @@ token = dict(urldecode(urlparse(url).query)) log.debug('Updating internal client token attribute.') self._populate_attributes(token) + self.token = token return token def _populate_attributes(self, token): @@ -363,6 +380,7 @@ log.debug('Obtained token %s', token) log.debug('Updating internal client attributes from token data.') self._populate_attributes(token) + self.token = token return token def rebuild_auth(self, prepared_request, response): diff -Nru python-requests-oauthlib-0.8.0/requests_oauthlib/oauth2_session.py python-requests-oauthlib-1.0.0/requests_oauthlib/oauth2_session.py --- python-requests-oauthlib-0.8.0/requests_oauthlib/oauth2_session.py 2017-02-14 15:08:57.000000000 +0000 +++ python-requests-oauthlib-1.0.0/requests_oauthlib/oauth2_session.py 2018-04-10 21:27:47.000000000 +0000 @@ -57,7 +57,7 @@ :auto_refresh_kwargs: Extra arguments to pass to the refresh token endpoint. :token_updater: Method with one argument, token, to be used to update - your token databse on automatic token refresh. If not + your token database on automatic token refresh. If not set a TokenUpdated warning will be raised when a token has been refreshed. This warning will carry the token in its token argument. @@ -77,9 +77,9 @@ # Allow customizations for non compliant providers through various # hooks to adjust requests and responses. self.compliance_hook = { - 'access_token_response': set([]), - 'refresh_token_response': set([]), - 'protected_request': set([]), + 'access_token_response': set(), + 'refresh_token_response': set(), + 'protected_request': set(), } def new_state(self): diff -Nru python-requests-oauthlib-0.8.0/requests_oauthlib.egg-info/PKG-INFO python-requests-oauthlib-1.0.0/requests_oauthlib.egg-info/PKG-INFO --- python-requests-oauthlib-0.8.0/requests_oauthlib.egg-info/PKG-INFO 2017-02-14 15:16:59.000000000 +0000 +++ python-requests-oauthlib-1.0.0/requests_oauthlib.egg-info/PKG-INFO 2018-06-04 09:12:18.000000000 +0000 @@ -1,6 +1,6 @@ -Metadata-Version: 1.1 +Metadata-Version: 2.1 Name: requests-oauthlib -Version: 0.8.0 +Version: 1.0.0 Summary: OAuthlib authentication support for Requests. Home-page: https://github.com/requests/requests-oauthlib Author: Kenneth Reitz @@ -30,9 +30,9 @@ >>> 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 + provider (e.g. 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 `_. + `OAuth 1 workflow guide on RTD `_. The OAuth 2 workflow -------------------- @@ -43,9 +43,9 @@ Fetching a protected resource after obtaining an access token can be extremely simple. However, before accessing resources you will need to obtain a few - credentials from your provider (i.e. Google) and authorization from the user + credentials from your provider (e.g. 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 `_. + full `OAuth 2 workflow guide on RTD `_. Installation ------------- @@ -60,15 +60,30 @@ :target: https://travis-ci.org/requests/requests-oauthlib .. |coverage-status| image:: https://img.shields.io/coveralls/requests/requests-oauthlib.svg :target: https://coveralls.io/r/requests/requests-oauthlib - .. |docs| image:: https://readthedocs.org/projects/requests-oauthlib/badge/?version=latest + .. |docs| image:: https://readthedocs.org/projects/requests-oauthlib/badge/ :alt: Documentation Status :scale: 100% - :target: https://readthedocs.org/projects/requests-oauthlib/ + :target: https://requests-oauthlib.readthedocs.io/ History ------- + UNRELEASED + ++++++++++ + + nothing yet + + v1.0.0 (4 June 2018) + ++++++++++++++++++++ + + - **Removed support for Python 2.6 and Python 3.3.** + This project now supports Python 2.7, and Python 3.4 and above. + - Added several examples to the documentation. + - Added plentymarkets compliance fix. + - Added a ``token`` property to OAuth1Session, to match the corresponding + ``token`` property on OAuth2Session. + v0.8.0 (14 February 2017) +++++++++++++++++++++++++ @@ -172,8 +187,11 @@ Classifier: Natural Language :: English Classifier: License :: OSI Approved :: BSD License Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2.6 +Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: 3.4 +Classifier: Programming Language :: Python :: 3.5 +Classifier: Programming Language :: Python :: 3.6 +Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.* +Provides-Extra: rsa diff -Nru python-requests-oauthlib-0.8.0/requests_oauthlib.egg-info/SOURCES.txt python-requests-oauthlib-1.0.0/requests_oauthlib.egg-info/SOURCES.txt --- python-requests-oauthlib-0.8.0/requests_oauthlib.egg-info/SOURCES.txt 2017-02-14 15:16:59.000000000 +0000 +++ python-requests-oauthlib-1.0.0/requests_oauthlib.egg-info/SOURCES.txt 2018-06-04 09:12:18.000000000 +0000 @@ -16,6 +16,7 @@ docs/examples/bitbucket.rst docs/examples/examples.rst docs/examples/facebook.rst +docs/examples/fitbit.rst docs/examples/github.rst docs/examples/google.rst docs/examples/linkedin.rst @@ -24,6 +25,7 @@ docs/examples/real_world_example.rst docs/examples/real_world_example_with_refresh.rst docs/examples/tumblr.rst +docs/examples/wso2.rst requests_oauthlib/__init__.py requests_oauthlib/oauth1_auth.py requests_oauthlib/oauth1_session.py @@ -41,6 +43,7 @@ requests_oauthlib/compliance_fixes/fitbit.py requests_oauthlib/compliance_fixes/linkedin.py requests_oauthlib/compliance_fixes/mailchimp.py +requests_oauthlib/compliance_fixes/plentymarkets.py requests_oauthlib/compliance_fixes/slack.py requests_oauthlib/compliance_fixes/weibo.py tests/__init__.py @@ -56,25 +59,9 @@ tests/test_oauth2_auth.pyc tests/test_oauth2_session.py tests/test_oauth2_session.pyc -tests/__pycache__/__init__.cpython-33.pyc -tests/__pycache__/__init__.cpython-34.pyc -tests/__pycache__/__init__.cpython-35.pyc -tests/__pycache__/test_compliance_fixes.cpython-33.pyc -tests/__pycache__/test_compliance_fixes.cpython-34.pyc -tests/__pycache__/test_compliance_fixes.cpython-35.pyc -tests/__pycache__/test_core.cpython-27-PYTEST.pyc -tests/__pycache__/test_core.cpython-33.pyc -tests/__pycache__/test_core.cpython-34.pyc -tests/__pycache__/test_core.cpython-35.pyc -tests/__pycache__/test_oauth1_session.cpython-27-PYTEST.pyc -tests/__pycache__/test_oauth1_session.cpython-33.pyc -tests/__pycache__/test_oauth1_session.cpython-34.pyc -tests/__pycache__/test_oauth1_session.cpython-35.pyc -tests/__pycache__/test_oauth2_auth.cpython-27-PYTEST.pyc -tests/__pycache__/test_oauth2_auth.cpython-33.pyc -tests/__pycache__/test_oauth2_auth.cpython-34.pyc -tests/__pycache__/test_oauth2_auth.cpython-35.pyc -tests/__pycache__/test_oauth2_session.cpython-27-PYTEST.pyc -tests/__pycache__/test_oauth2_session.cpython-33.pyc -tests/__pycache__/test_oauth2_session.cpython-34.pyc -tests/__pycache__/test_oauth2_session.cpython-35.pyc \ No newline at end of file +tests/__pycache__/__init__.cpython-36.pyc +tests/__pycache__/test_compliance_fixes.cpython-36-PYTEST.pyc +tests/__pycache__/test_core.cpython-36-PYTEST.pyc +tests/__pycache__/test_oauth1_session.cpython-36-PYTEST.pyc +tests/__pycache__/test_oauth2_auth.cpython-36-PYTEST.pyc +tests/__pycache__/test_oauth2_session.cpython-36-PYTEST.pyc \ No newline at end of file diff -Nru python-requests-oauthlib-0.8.0/setup.cfg python-requests-oauthlib-1.0.0/setup.cfg --- python-requests-oauthlib-0.8.0/setup.cfg 2017-02-14 15:17:00.000000000 +0000 +++ python-requests-oauthlib-1.0.0/setup.cfg 2018-06-04 09:12:18.000000000 +0000 @@ -1,6 +1,9 @@ [bdist_wheel] universal = 1 +[metadata] +license_file = LICENSE + [egg_info] tag_build = tag_date = 0 diff -Nru python-requests-oauthlib-0.8.0/setup.py python-requests-oauthlib-1.0.0/setup.py --- python-requests-oauthlib-0.8.0/setup.py 2016-02-19 15:57:38.000000000 +0000 +++ python-requests-oauthlib-1.0.0/setup.py 2018-05-16 16:55:12.000000000 +0000 @@ -5,10 +5,8 @@ import sys import re -try: - from setuptools import setup -except ImportError: - from distutils.core import setup +from setuptools import setup + # Get the version version_regex = r'__version__ = ["\']([^"\']*)["\']' @@ -24,29 +22,28 @@ APP_NAME = 'requests-oauthlib' -settings = dict() - - # Publish Helper. if sys.argv[-1] == 'publish': os.system('python setup.py sdist upload') sys.exit() -tests_require = ['mock', 'requests-mock'] -if sys.version_info < (2, 7): # Python 2.6 or lower - tests_require.append('unittest2') +def readall(path): + with open(path) as fp: + return fp.read() -settings.update( + +setup( name=APP_NAME, version=VERSION, description='OAuthlib authentication support for Requests.', - long_description=open('README.rst').read() + '\n\n' + - open('HISTORY.rst').read(), + long_description=readall('README.rst') + '\n\n' + + readall('HISTORY.rst'), author='Kenneth Reitz', author_email='me@kennethreitz.com', url='https://github.com/requests/requests-oauthlib', packages=['requests_oauthlib', 'requests_oauthlib.compliance_fixes'], + python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", install_requires=['oauthlib>=0.6.2', 'requests>=2.0.0'], extras_require={'rsa': ['oauthlib[rsa]>=0.6.2', 'requests>=2.0.0']}, license='ISC', @@ -56,15 +53,17 @@ 'Natural Language :: English', 'License :: OSI Approved :: BSD License', 'Programming Language :: Python', - 'Programming Language :: Python :: 2.6', + 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', ), zip_safe=False, - tests_require=tests_require, + tests_require=[ + 'mock', + 'requests-mock', + ], test_suite='tests' ) - -setup(**settings) Binary files /tmp/tmpBWLThc/TaSpXOYCst/python-requests-oauthlib-0.8.0/tests/__init__.pyc and /tmp/tmpBWLThc/MCrAXsxjbZ/python-requests-oauthlib-1.0.0/tests/__init__.pyc differ Binary files /tmp/tmpBWLThc/TaSpXOYCst/python-requests-oauthlib-0.8.0/tests/__pycache__/__init__.cpython-33.pyc and /tmp/tmpBWLThc/MCrAXsxjbZ/python-requests-oauthlib-1.0.0/tests/__pycache__/__init__.cpython-33.pyc differ Binary files /tmp/tmpBWLThc/TaSpXOYCst/python-requests-oauthlib-0.8.0/tests/__pycache__/__init__.cpython-34.pyc and /tmp/tmpBWLThc/MCrAXsxjbZ/python-requests-oauthlib-1.0.0/tests/__pycache__/__init__.cpython-34.pyc differ Binary files /tmp/tmpBWLThc/TaSpXOYCst/python-requests-oauthlib-0.8.0/tests/__pycache__/__init__.cpython-35.pyc and /tmp/tmpBWLThc/MCrAXsxjbZ/python-requests-oauthlib-1.0.0/tests/__pycache__/__init__.cpython-35.pyc differ Binary files /tmp/tmpBWLThc/TaSpXOYCst/python-requests-oauthlib-0.8.0/tests/__pycache__/__init__.cpython-36.pyc and /tmp/tmpBWLThc/MCrAXsxjbZ/python-requests-oauthlib-1.0.0/tests/__pycache__/__init__.cpython-36.pyc differ Binary files /tmp/tmpBWLThc/TaSpXOYCst/python-requests-oauthlib-0.8.0/tests/__pycache__/test_compliance_fixes.cpython-33.pyc and /tmp/tmpBWLThc/MCrAXsxjbZ/python-requests-oauthlib-1.0.0/tests/__pycache__/test_compliance_fixes.cpython-33.pyc differ Binary files /tmp/tmpBWLThc/TaSpXOYCst/python-requests-oauthlib-0.8.0/tests/__pycache__/test_compliance_fixes.cpython-34.pyc and /tmp/tmpBWLThc/MCrAXsxjbZ/python-requests-oauthlib-1.0.0/tests/__pycache__/test_compliance_fixes.cpython-34.pyc differ Binary files /tmp/tmpBWLThc/TaSpXOYCst/python-requests-oauthlib-0.8.0/tests/__pycache__/test_compliance_fixes.cpython-35.pyc and /tmp/tmpBWLThc/MCrAXsxjbZ/python-requests-oauthlib-1.0.0/tests/__pycache__/test_compliance_fixes.cpython-35.pyc differ Binary files /tmp/tmpBWLThc/TaSpXOYCst/python-requests-oauthlib-0.8.0/tests/__pycache__/test_compliance_fixes.cpython-36-PYTEST.pyc and /tmp/tmpBWLThc/MCrAXsxjbZ/python-requests-oauthlib-1.0.0/tests/__pycache__/test_compliance_fixes.cpython-36-PYTEST.pyc differ Binary files /tmp/tmpBWLThc/TaSpXOYCst/python-requests-oauthlib-0.8.0/tests/__pycache__/test_core.cpython-27-PYTEST.pyc and /tmp/tmpBWLThc/MCrAXsxjbZ/python-requests-oauthlib-1.0.0/tests/__pycache__/test_core.cpython-27-PYTEST.pyc differ Binary files /tmp/tmpBWLThc/TaSpXOYCst/python-requests-oauthlib-0.8.0/tests/__pycache__/test_core.cpython-33.pyc and /tmp/tmpBWLThc/MCrAXsxjbZ/python-requests-oauthlib-1.0.0/tests/__pycache__/test_core.cpython-33.pyc differ Binary files /tmp/tmpBWLThc/TaSpXOYCst/python-requests-oauthlib-0.8.0/tests/__pycache__/test_core.cpython-34.pyc and /tmp/tmpBWLThc/MCrAXsxjbZ/python-requests-oauthlib-1.0.0/tests/__pycache__/test_core.cpython-34.pyc differ Binary files /tmp/tmpBWLThc/TaSpXOYCst/python-requests-oauthlib-0.8.0/tests/__pycache__/test_core.cpython-35.pyc and /tmp/tmpBWLThc/MCrAXsxjbZ/python-requests-oauthlib-1.0.0/tests/__pycache__/test_core.cpython-35.pyc differ Binary files /tmp/tmpBWLThc/TaSpXOYCst/python-requests-oauthlib-0.8.0/tests/__pycache__/test_core.cpython-36-PYTEST.pyc and /tmp/tmpBWLThc/MCrAXsxjbZ/python-requests-oauthlib-1.0.0/tests/__pycache__/test_core.cpython-36-PYTEST.pyc differ Binary files /tmp/tmpBWLThc/TaSpXOYCst/python-requests-oauthlib-0.8.0/tests/__pycache__/test_oauth1_session.cpython-27-PYTEST.pyc and /tmp/tmpBWLThc/MCrAXsxjbZ/python-requests-oauthlib-1.0.0/tests/__pycache__/test_oauth1_session.cpython-27-PYTEST.pyc differ Binary files /tmp/tmpBWLThc/TaSpXOYCst/python-requests-oauthlib-0.8.0/tests/__pycache__/test_oauth1_session.cpython-33.pyc and /tmp/tmpBWLThc/MCrAXsxjbZ/python-requests-oauthlib-1.0.0/tests/__pycache__/test_oauth1_session.cpython-33.pyc differ Binary files /tmp/tmpBWLThc/TaSpXOYCst/python-requests-oauthlib-0.8.0/tests/__pycache__/test_oauth1_session.cpython-34.pyc and /tmp/tmpBWLThc/MCrAXsxjbZ/python-requests-oauthlib-1.0.0/tests/__pycache__/test_oauth1_session.cpython-34.pyc differ Binary files /tmp/tmpBWLThc/TaSpXOYCst/python-requests-oauthlib-0.8.0/tests/__pycache__/test_oauth1_session.cpython-35.pyc and /tmp/tmpBWLThc/MCrAXsxjbZ/python-requests-oauthlib-1.0.0/tests/__pycache__/test_oauth1_session.cpython-35.pyc differ Binary files /tmp/tmpBWLThc/TaSpXOYCst/python-requests-oauthlib-0.8.0/tests/__pycache__/test_oauth1_session.cpython-36-PYTEST.pyc and /tmp/tmpBWLThc/MCrAXsxjbZ/python-requests-oauthlib-1.0.0/tests/__pycache__/test_oauth1_session.cpython-36-PYTEST.pyc differ Binary files /tmp/tmpBWLThc/TaSpXOYCst/python-requests-oauthlib-0.8.0/tests/__pycache__/test_oauth2_auth.cpython-27-PYTEST.pyc and /tmp/tmpBWLThc/MCrAXsxjbZ/python-requests-oauthlib-1.0.0/tests/__pycache__/test_oauth2_auth.cpython-27-PYTEST.pyc differ Binary files /tmp/tmpBWLThc/TaSpXOYCst/python-requests-oauthlib-0.8.0/tests/__pycache__/test_oauth2_auth.cpython-33.pyc and /tmp/tmpBWLThc/MCrAXsxjbZ/python-requests-oauthlib-1.0.0/tests/__pycache__/test_oauth2_auth.cpython-33.pyc differ Binary files /tmp/tmpBWLThc/TaSpXOYCst/python-requests-oauthlib-0.8.0/tests/__pycache__/test_oauth2_auth.cpython-34.pyc and /tmp/tmpBWLThc/MCrAXsxjbZ/python-requests-oauthlib-1.0.0/tests/__pycache__/test_oauth2_auth.cpython-34.pyc differ Binary files /tmp/tmpBWLThc/TaSpXOYCst/python-requests-oauthlib-0.8.0/tests/__pycache__/test_oauth2_auth.cpython-35.pyc and /tmp/tmpBWLThc/MCrAXsxjbZ/python-requests-oauthlib-1.0.0/tests/__pycache__/test_oauth2_auth.cpython-35.pyc differ Binary files /tmp/tmpBWLThc/TaSpXOYCst/python-requests-oauthlib-0.8.0/tests/__pycache__/test_oauth2_auth.cpython-36-PYTEST.pyc and /tmp/tmpBWLThc/MCrAXsxjbZ/python-requests-oauthlib-1.0.0/tests/__pycache__/test_oauth2_auth.cpython-36-PYTEST.pyc differ Binary files /tmp/tmpBWLThc/TaSpXOYCst/python-requests-oauthlib-0.8.0/tests/__pycache__/test_oauth2_session.cpython-27-PYTEST.pyc and /tmp/tmpBWLThc/MCrAXsxjbZ/python-requests-oauthlib-1.0.0/tests/__pycache__/test_oauth2_session.cpython-27-PYTEST.pyc differ Binary files /tmp/tmpBWLThc/TaSpXOYCst/python-requests-oauthlib-0.8.0/tests/__pycache__/test_oauth2_session.cpython-33.pyc and /tmp/tmpBWLThc/MCrAXsxjbZ/python-requests-oauthlib-1.0.0/tests/__pycache__/test_oauth2_session.cpython-33.pyc differ Binary files /tmp/tmpBWLThc/TaSpXOYCst/python-requests-oauthlib-0.8.0/tests/__pycache__/test_oauth2_session.cpython-34.pyc and /tmp/tmpBWLThc/MCrAXsxjbZ/python-requests-oauthlib-1.0.0/tests/__pycache__/test_oauth2_session.cpython-34.pyc differ Binary files /tmp/tmpBWLThc/TaSpXOYCst/python-requests-oauthlib-0.8.0/tests/__pycache__/test_oauth2_session.cpython-35.pyc and /tmp/tmpBWLThc/MCrAXsxjbZ/python-requests-oauthlib-1.0.0/tests/__pycache__/test_oauth2_session.cpython-35.pyc differ Binary files /tmp/tmpBWLThc/TaSpXOYCst/python-requests-oauthlib-0.8.0/tests/__pycache__/test_oauth2_session.cpython-36-PYTEST.pyc and /tmp/tmpBWLThc/MCrAXsxjbZ/python-requests-oauthlib-1.0.0/tests/__pycache__/test_oauth2_session.cpython-36-PYTEST.pyc differ diff -Nru python-requests-oauthlib-0.8.0/tests/test_compliance_fixes.py python-requests-oauthlib-1.0.0/tests/test_compliance_fixes.py --- python-requests-oauthlib-0.8.0/tests/test_compliance_fixes.py 2017-02-14 15:08:57.000000000 +0000 +++ python-requests-oauthlib-1.0.0/tests/test_compliance_fixes.py 2018-04-10 21:27:47.000000000 +0000 @@ -1,8 +1,5 @@ from __future__ import unicode_literals -try: - from unittest2 import TestCase -except ImportError: - from unittest import TestCase +from unittest import TestCase import requests import requests_mock @@ -20,6 +17,7 @@ from requests_oauthlib.compliance_fixes import mailchimp_compliance_fix from requests_oauthlib.compliance_fixes import weibo_compliance_fix from requests_oauthlib.compliance_fixes import slack_compliance_fix +from requests_oauthlib.compliance_fixes import plentymarkets_compliance_fix class FacebookComplianceFixTest(TestCase): @@ -275,3 +273,40 @@ query = parse_qs(urlparse(url).query) self.assertEqual(query["token"], ["different-token"]) self.assertIsNone(response.request.body) + + +class PlentymarketsComplianceFixTest(TestCase): + + def setUp(self): + mocker = requests_mock.Mocker() + mocker.post( + "https://shop.plentymarkets-cloud02.com", + json= + { + "accessToken": "ecUN1r8KhJewMCdLAmpHOdZ4O0ofXKB9zf6CXK61", + "tokenType": "Bearer", + "expiresIn": 86400, + "refreshToken": "iG2kBGIjcXaRE4xmTVUnv7xwxX7XMcWCHqJmFaSX" + }, + headers={"Content-Type": "application/json"} + ) + mocker.start() + self.addCleanup(mocker.stop) + + plentymarkets = OAuth2Session('foo', redirect_uri='https://i.b') + self.session = plentymarkets_compliance_fix(plentymarkets) + + def test_fetch_access_token(self): + token = self.session.fetch_token( + "https://shop.plentymarkets-cloud02.com", + authorization_response='https://i.b/?code=hello', + ) + + approx_expires_at = time.time() + 86400 + actual_expires_at = token.pop('expires_at') + self.assertAlmostEqual(actual_expires_at, approx_expires_at, places=2) + + self.assertEqual(token, {u'access_token': u'ecUN1r8KhJewMCdLAmpHOdZ4O0ofXKB9zf6CXK61', + u'expires_in': 86400, + u'token_type': u'Bearer', + u'refresh_token': u'iG2kBGIjcXaRE4xmTVUnv7xwxX7XMcWCHqJmFaSX'}) Binary files /tmp/tmpBWLThc/TaSpXOYCst/python-requests-oauthlib-0.8.0/tests/test_compliance_fixes.pyc and /tmp/tmpBWLThc/MCrAXsxjbZ/python-requests-oauthlib-1.0.0/tests/test_compliance_fixes.pyc differ diff -Nru python-requests-oauthlib-0.8.0/tests/test_core.py python-requests-oauthlib-1.0.0/tests/test_core.py --- python-requests-oauthlib-0.8.0/tests/test_core.py 2014-06-06 13:18:24.000000000 +0000 +++ python-requests-oauthlib-1.0.0/tests/test_core.py 2018-04-10 21:27:47.000000000 +0000 @@ -6,32 +6,14 @@ import requests_oauthlib import oauthlib import os.path -try: - from io import StringIO # python 3 -except ImportError: - from StringIO import StringIO # python 2 +from io import StringIO import unittest -if sys.version[0] == '3': - bytes_type = bytes -else: - bytes_type = str - @mock.patch('oauthlib.oauth1.rfc5849.generate_timestamp') @mock.patch('oauthlib.oauth1.rfc5849.generate_nonce') class OAuth1Test(unittest.TestCase): - def setUp(self): - def converting_equals(a, b): - if isinstance(a, bytes_type): - a = a.decode('utf-8') - if isinstance(b, bytes_type): - b = b.decode('utf-8') - self.assertEquals(a, b) - - self.assertEqual = converting_equals - def testFormEncoded(self, generate_nonce, generate_timestamp): """OAuth1 assumes form encoded if content type is not specified.""" generate_nonce.return_value = 'abc' @@ -43,16 +25,16 @@ a = r.prepare() self.assertEqual(a.url, 'http://a.b/path?query=retain') - self.assertEqual(a.body, 'this=really&is=&+form=encoded') - self.assertEqual(a.headers.get('Content-Type'), 'application/x-www-form-urlencoded') + self.assertEqual(a.body, b'this=really&is=&+form=encoded') + self.assertEqual(a.headers.get('Content-Type'), b'application/x-www-form-urlencoded') # guess content-type r = requests.Request(method='POST', url='http://a.b/path?query=retain', auth=oauth, data='this=really&is=&+form=encoded') b = r.prepare() self.assertEqual(b.url, 'http://a.b/path?query=retain') - self.assertEqual(b.body, 'this=really&is=&+form=encoded') - self.assertEqual(b.headers.get('Content-Type'), 'application/x-www-form-urlencoded') + self.assertEqual(b.body, b'this=really&is=&+form=encoded') + self.assertEqual(b.headers.get('Content-Type'), b'application/x-www-form-urlencoded') self.assertEqual(a.headers.get('Authorization'), b.headers.get('Authorization')) @@ -120,11 +102,11 @@ data = 'a' r = requests.post('http://httpbin.org/get', data=data, auth=oauth) self.assertEqual(r.request.headers.get('Content-Type'), - 'application/x-www-form-urlencoded') + b'application/x-www-form-urlencoded') r = requests.post('http://httpbin.org/get', auth=oauth, data=data, headers={'Content-type': 'application/json'}) self.assertEqual(r.request.headers.get('Content-Type'), - 'application/json') + b'application/json') def test_register_client_class(self, generate_timestamp, generate_nonce): Binary files /tmp/tmpBWLThc/TaSpXOYCst/python-requests-oauthlib-0.8.0/tests/test_core.pyc and /tmp/tmpBWLThc/MCrAXsxjbZ/python-requests-oauthlib-1.0.0/tests/test_core.pyc differ diff -Nru python-requests-oauthlib-0.8.0/tests/test_oauth1_session.py python-requests-oauthlib-1.0.0/tests/test_oauth1_session.py --- python-requests-oauthlib-0.8.0/tests/test_oauth1_session.py 2016-02-19 15:59:49.000000000 +0000 +++ python-requests-oauthlib-1.0.0/tests/test_oauth1_session.py 2018-05-16 16:55:12.000000000 +0000 @@ -3,15 +3,12 @@ import unittest import sys import requests +from io import StringIO from oauthlib.oauth1 import SIGNATURE_TYPE_QUERY, SIGNATURE_TYPE_BODY from oauthlib.oauth1 import SIGNATURE_RSA, SIGNATURE_PLAINTEXT from requests_oauthlib import OAuth1Session -try: - from StringIO import StringIO -except ImportError: - from io import StringIO try: import cryptography @@ -25,19 +22,6 @@ unicode_type = unicode bytes_type = str -# Monkey patch Python 2.6 unittest -if not hasattr(unittest, 'SkipTest'): - unittest.SkipTest = RuntimeWarning - unittest.TestResult.real_add_error = unittest.TestResult.addError - - def patched_addError(self, test, exc_info): - if exc_info[0] is RuntimeWarning: - print(str(exc_info[1]), end=' ', file=sys.stderr) - return - else: - self.real_add_error(test, exc_info) - unittest.TestResult.addError = patched_addError - TEST_RSA_KEY = ( "-----BEGIN RSA PRIVATE KEY-----\n" @@ -257,6 +241,42 @@ del auth._client.client.verifier self._test_fetch_access_token_raises_error(auth) + def test_token_proxy_set(self): + token = { + 'oauth_token': 'fake-key', + 'oauth_token_secret': 'fake-secret', + 'oauth_verifier': 'fake-verifier', + } + sess = OAuth1Session('foo') + self.assertIsNone(sess._client.client.resource_owner_key) + self.assertIsNone(sess._client.client.resource_owner_secret) + self.assertIsNone(sess._client.client.verifier) + self.assertEqual(sess.token, {}) + + sess.token = token + self.assertEqual(sess._client.client.resource_owner_key, 'fake-key') + self.assertEqual(sess._client.client.resource_owner_secret, 'fake-secret') + self.assertEqual(sess._client.client.verifier, 'fake-verifier') + + def test_token_proxy_get(self): + token = { + 'oauth_token': 'fake-key', + 'oauth_token_secret': 'fake-secret', + 'oauth_verifier': 'fake-verifier', + } + sess = OAuth1Session( + 'foo', + resource_owner_key=token['oauth_token'], + resource_owner_secret=token['oauth_token_secret'], + verifier=token['oauth_verifier'], + ) + self.assertEqual(sess.token, token) + + sess._client.client.resource_owner_key = "different-key" + token['oauth_token'] = "different-key" + + self.assertEqual(sess.token, token) + def test_authorized_false(self): sess = OAuth1Session('foo') self.assertFalse(sess.authorized) Binary files /tmp/tmpBWLThc/TaSpXOYCst/python-requests-oauthlib-0.8.0/tests/test_oauth1_session.pyc and /tmp/tmpBWLThc/MCrAXsxjbZ/python-requests-oauthlib-1.0.0/tests/test_oauth1_session.pyc differ Binary files /tmp/tmpBWLThc/TaSpXOYCst/python-requests-oauthlib-0.8.0/tests/test_oauth2_auth.pyc and /tmp/tmpBWLThc/MCrAXsxjbZ/python-requests-oauthlib-1.0.0/tests/test_oauth2_auth.pyc differ diff -Nru python-requests-oauthlib-0.8.0/tests/test_oauth2_session.py python-requests-oauthlib-1.0.0/tests/test_oauth2_session.py --- python-requests-oauthlib-0.8.0/tests/test_oauth2_session.py 2016-09-22 11:47:41.000000000 +0000 +++ python-requests-oauthlib-1.0.0/tests/test_oauth2_session.py 2018-04-10 21:27:47.000000000 +0000 @@ -4,10 +4,7 @@ import time from base64 import b64encode from copy import deepcopy -try: - from unittest2 import TestCase -except ImportError: - from unittest import TestCase +from unittest import TestCase from oauthlib.common import urlencode from oauthlib.oauth2 import TokenExpiredError, OAuth2Error @@ -55,9 +52,7 @@ token = 'Bearer ' + self.token['access_token'] def verifier(r, **kwargs): - auth_header = r.headers.get('Authorization', None) - if 'Authorization'.encode('utf-8') in r.headers: - auth_header = r.headers['Authorization'.encode('utf-8')] + auth_header = r.headers.get(str('Authorization'), None) self.assertEqual(auth_header, token) resp = mock.MagicMock() resp.cookes = [] @@ -248,4 +243,3 @@ self.assertFalse(sess.authorized) sess.fetch_token(url) self.assertTrue(sess.authorized) - Binary files /tmp/tmpBWLThc/TaSpXOYCst/python-requests-oauthlib-0.8.0/tests/test_oauth2_session.pyc and /tmp/tmpBWLThc/MCrAXsxjbZ/python-requests-oauthlib-1.0.0/tests/test_oauth2_session.pyc differ