Hello community,
here is the log from the commit of package python-requests-oauthlib for
openSUSE:Factory checked in at 2017-05-17 10:54:16
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-requests-oauthlib (Old)
and /work/SRC/openSUSE:Factory/.python-requests-oauthlib.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-requests-oauthlib"
Wed May 17 10:54:16 2017 rev:3 rq:494947 version:0.8.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-requests-oauthlib/python-requests-oauthlib.changes
2017-02-03 18:58:22.149350774 +0100
+++
/work/SRC/openSUSE:Factory/.python-requests-oauthlib.new/python-requests-oauthlib.changes
2017-05-17 10:54:17.195397837 +0200
@@ -1,0 +2,16 @@
+Wed Apr 26 08:55:54 UTC 2017 - [email protected]
+
+- Update to version 0.8.0:
+ * Convert package to singlespec
+ * Added Outlook Calender API example
+ * Mentioned file to example.rst
+ * Update google.rst
+ * Allow OAuth2 session request() to take client_id and client_secret
+ * Add requests-mock to tox dependencies.
+ * Strips new lines in fetch_token response body
+ * Prefer user-supplied auth credentials.
+ * add a fitbit compliance fix
+ * test successful fitbit auth calls as well
+ * v0.8.0
+
+-------------------------------------------------------------------
Old:
----
requests-oauthlib-0.7.0.tar.gz
New:
----
_service
requests-oauthlib-0.8.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-requests-oauthlib.spec ++++++
--- /var/tmp/diff_new_pack.0T3PNl/_old 2017-05-17 10:54:18.135265618 +0200
+++ /var/tmp/diff_new_pack.0T3PNl/_new 2017-05-17 10:54:18.139265055 +0200
@@ -16,26 +16,31 @@
#
+%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-requests-oauthlib
-Version: 0.7.0
+Version: 0.8.0
Release: 0
Summary: OAuthlib authentication support for Requests
License: ISC
Group: Development/Languages/Python
Url: https://github.com/requests/requests-oauthlib
Source:
https://pypi.io/packages/source/r/requests-oauthlib/requests-oauthlib-%{version}.tar.gz
-BuildRequires: python-devel
-BuildRequires: python-oauthlib >= 0.6.2
-BuildRequires: python-setuptools
-Requires: python-oauthlib >= 0.6.2
-BuildRequires: python-requests >= 2.0.0
-Requires: python-requests >= 2.0.0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-%if 0%{?suse_version} && 0%{?suse_version} <= 1110
-%{!?python_sitelib: %global python_sitelib %(python -c "from
distutils.sysconfig import get_python_lib; print get_python_lib()")}
-%else
BuildArch: noarch
-%endif
+
+BuildRequires: fdupes
+BuildRequires: python-rpm-macros
+
+BuildRequires: %{python_module devel}
+BuildRequires: %{python_module mock}
+BuildRequires: %{python_module oauthlib >= 0.6.2}
+BuildRequires: %{python_module requests >= 2.0.0}
+BuildRequires: %{python_module setuptools}
+
+Requires: python-oauthlib >= 0.6.2
+Requires: python-requests >= 2.0.0
+
+%python_subpackages
%description
This project provides first-class OAuth library support for Requests.
@@ -44,15 +49,18 @@
%setup -q -n requests-oauthlib-%{version}
%build
-python setup.py build
+%python_build
%install
-python setup.py install --prefix=%{_prefix} --root=%{buildroot}
+%python_install
+
+#hardlink duplicated files
+%fdupes %{buildroot}
%check
-# python setup.py test
+#%%python_exec setup.py test
-%files
+%files %python_files
%defattr(-,root,root,-)
%doc AUTHORS.rst LICENSE README.rst
%{python_sitelib}/*
++++++ _service ++++++
<services>
<service name="download_files" mode="localonly">
<param name="enforceupstream">yes</param>
<param name="changesgenerate">enable</param>
</service>
<service name="set_version" mode="localonly"/>
</services>
++++++ requests-oauthlib-0.7.0.tar.gz -> requests-oauthlib-0.8.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-oauthlib-0.7.0/HISTORY.rst
new/requests-oauthlib-0.8.0/HISTORY.rst
--- old/requests-oauthlib-0.7.0/HISTORY.rst 2016-09-22 13:59:17.000000000
+0200
+++ new/requests-oauthlib-0.8.0/HISTORY.rst 2017-02-14 16:15:05.000000000
+0100
@@ -1,6 +1,17 @@
History
-------
+v0.8.0 (14 February 2017)
++++++++++++++++++++++++++
+
+- Added Fitbit compliance fix.
+- Fixed an issue where newlines in the response body for the access token
+ request would cause errors when trying to extract the token.
+- Fixed an issue introduced in v0.7.0 where users passing ``auth`` to several
+ methods would encounter conflicts with the ``client_id`` and
+ ``client_secret``-derived auth. The user-supplied ``auth`` argument is now
+ used in preference to those options.
+
v0.7.0 (22 September 2016)
++++++++++++++++++++++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-oauthlib-0.7.0/PKG-INFO
new/requests-oauthlib-0.8.0/PKG-INFO
--- old/requests-oauthlib-0.7.0/PKG-INFO 2016-09-22 14:00:04.000000000
+0200
+++ new/requests-oauthlib-0.8.0/PKG-INFO 2017-02-14 16:17:00.000000000
+0100
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: requests-oauthlib
-Version: 0.7.0
+Version: 0.8.0
Summary: OAuthlib authentication support for Requests.
Home-page: https://github.com/requests/requests-oauthlib
Author: Kenneth Reitz
@@ -69,6 +69,17 @@
History
-------
+ v0.8.0 (14 February 2017)
+ +++++++++++++++++++++++++
+
+ - Added Fitbit compliance fix.
+ - Fixed an issue where newlines in the response body for the access
token
+ request would cause errors when trying to extract the token.
+ - Fixed an issue introduced in v0.7.0 where users passing ``auth`` to
several
+ methods would encounter conflicts with the ``client_id`` and
+ ``client_secret``-derived auth. The user-supplied ``auth`` argument
is now
+ used in preference to those options.
+
v0.7.0 (22 September 2016)
++++++++++++++++++++++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-oauthlib-0.7.0/docs/examples/examples.rst
new/requests-oauthlib-0.8.0/docs/examples/examples.rst
--- old/requests-oauthlib-0.7.0/docs/examples/examples.rst 2014-06-06
15:18:24.000000000 +0200
+++ new/requests-oauthlib-0.8.0/docs/examples/examples.rst 2016-10-14
12:12:16.000000000 +0200
@@ -9,6 +9,7 @@
google
facebook
linkedin
+ outlook
tumblr
real_world_example
real_world_example_with_refresh
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-oauthlib-0.7.0/docs/examples/outlook.rst
new/requests-oauthlib-0.8.0/docs/examples/outlook.rst
--- old/requests-oauthlib-0.7.0/docs/examples/outlook.rst 1970-01-01
01:00:00.000000000 +0100
+++ new/requests-oauthlib-0.8.0/docs/examples/outlook.rst 2016-10-14
12:12:16.000000000 +0200
@@ -0,0 +1,37 @@
+Outlook Calender OAuth 2 Tutorial
+==========================
+
+Create a new web application client in the `Microsoft Application Registration
Portal`_
+When you have obtained a ``client_id``, ``client_secret`` and registered
+a callback URL then you can try out the command line interactive example below.
+
+.. _`Outlook App console`: https://apps.dev.microsoft.com
+
+.. code-block:: pycon
+
+ >>> # This information is obtained upon registration of a new Outlook
Application
+ >>> client_id = '<the id you get from outlook>'
+ >>> client_secret = '<the secret you get from outlook>'
+
+ >>> # OAuth endpoints given in Outlook API documentation
+ >>> authorization_base_url =
'https://login.microsoftonline.com/common/oauth2/v2.0/authorize'
+ >>> token_url =
'https://login.microsoftonline.com/common/oauth2/v2.0/token'
+ >>> scope = ['https://outlook.office.com/calendars.readwrite']
+ >>> redirect_uri = 'https://localhost/' # Should match Site URL
+
+ >>> from requests_oauthlib import OAuth2Session
+ >>> outlook =
OAuth2Session(client_id,scope=scope,redirect_uri=redirect_uri)
+
+ >>> # Redirect the user owner to the OAuth provider (i.e. Outlook) using
an URL with a few key OAuth parameters.
+ >>> authorization_url, state =
outlook.authorization_url(authorization_base_url)
+ >>> print 'Please go here and authorize,', authorization_url
+
+ >>> # Get the authorization verifier code from the callback url
+ >>> redirect_response = raw_input('Paste the full redirect URL here:')
+
+ >>> # Fetch the access token
+ >>> token =
outlook.fetch_token(token_url,client_secret=client_secret,authorization_response=redirect_response)
+
+ >>> # Fetch a protected resource, i.e. calender information
+ >>> o = outlook.get('https://outlook.office.com/api/v1.0/me/calendars')
+ >>> print o.content
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/requests-oauthlib-0.7.0/requests_oauthlib/__init__.py
new/requests-oauthlib-0.8.0/requests_oauthlib/__init__.py
--- old/requests-oauthlib-0.7.0/requests_oauthlib/__init__.py 2016-09-22
13:59:44.000000000 +0200
+++ new/requests-oauthlib-0.8.0/requests_oauthlib/__init__.py 2017-02-14
16:15:35.000000000 +0100
@@ -3,7 +3,7 @@
from .oauth2_auth import OAuth2
from .oauth2_session import OAuth2Session, TokenUpdated
-__version__ = '0.7.0'
+__version__ = '0.8.0'
import requests
if requests.__version__ < '2.0.0':
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/requests-oauthlib-0.7.0/requests_oauthlib/compliance_fixes/__init__.py
new/requests-oauthlib-0.8.0/requests_oauthlib/compliance_fixes/__init__.py
--- old/requests-oauthlib-0.7.0/requests_oauthlib/compliance_fixes/__init__.py
2015-12-14 12:32:41.000000000 +0100
+++ new/requests-oauthlib-0.8.0/requests_oauthlib/compliance_fixes/__init__.py
2017-02-14 16:08:57.000000000 +0100
@@ -1,6 +1,7 @@
from __future__ import absolute_import
from .facebook import facebook_compliance_fix
+from .fitbit import fitbit_compliance_fix
from .linkedin import linkedin_compliance_fix
from .slack import slack_compliance_fix
from .mailchimp import mailchimp_compliance_fix
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/requests-oauthlib-0.7.0/requests_oauthlib/compliance_fixes/fitbit.py
new/requests-oauthlib-0.8.0/requests_oauthlib/compliance_fixes/fitbit.py
--- old/requests-oauthlib-0.7.0/requests_oauthlib/compliance_fixes/fitbit.py
1970-01-01 01:00:00.000000000 +0100
+++ new/requests-oauthlib-0.8.0/requests_oauthlib/compliance_fixes/fitbit.py
2017-02-14 16:08:57.000000000 +0100
@@ -0,0 +1,26 @@
+"""
+The Fitbit API breaks from the OAuth2 RFC standard by returning an "errors"
+object list, rather than a single "error" string. This puts hooks in place so
+that oauthlib can process an error in the results from access token and refresh
+token responses. This is necessary to prevent getting the generic red herring
+MissingTokenError.
+"""
+
+from json import loads, dumps
+
+from oauthlib.common import to_unicode
+
+
+def fitbit_compliance_fix(session):
+
+ def _missing_error(r):
+ token = loads(r.text)
+ if 'errors' in token:
+ # Set the error to the first one we have
+ token['error'] = token['errors'][0]['errorType']
+ r._content = to_unicode(dumps(token)).encode('UTF-8')
+ return r
+
+ session.register_compliance_hook('access_token_response', _missing_error)
+ session.register_compliance_hook('refresh_token_response', _missing_error)
+ return session
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/requests-oauthlib-0.7.0/requests_oauthlib/oauth1_session.py
new/requests-oauthlib-0.8.0/requests_oauthlib/oauth1_session.py
--- old/requests-oauthlib-0.7.0/requests_oauthlib/oauth1_session.py
2016-02-19 16:59:49.000000000 +0100
+++ new/requests-oauthlib-0.8.0/requests_oauthlib/oauth1_session.py
2016-10-14 12:12:16.000000000 +0200
@@ -352,7 +352,7 @@
log.debug('Decoding token from response "%s"', r.text)
try:
- token = dict(urldecode(r.text))
+ token = dict(urldecode(r.text.strip()))
except ValueError as e:
error = ("Unable to decode token from token response. "
"This is commonly caused by an unsuccessful request where"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/requests-oauthlib-0.7.0/requests_oauthlib/oauth2_session.py
new/requests-oauthlib-0.8.0/requests_oauthlib/oauth2_session.py
--- old/requests-oauthlib-0.7.0/requests_oauthlib/oauth2_session.py
2016-09-22 13:47:41.000000000 +0200
+++ new/requests-oauthlib-0.8.0/requests_oauthlib/oauth2_session.py
2017-02-14 16:08:57.000000000 +0100
@@ -333,8 +333,10 @@
if self.auto_refresh_url:
log.debug('Auto refresh is set, attempting to refresh at
%s.',
self.auto_refresh_url)
- auth = None
- if client_id and client_secret:
+
+ # We mustn't pass auth twice.
+ auth = kwargs.pop('auth', None)
+ if client_id and client_secret and (auth is None):
log.debug('Encoding client_id "%s" with client_secret
as Basic auth credentials.', client_id)
auth = requests.auth.HTTPBasicAuth(client_id,
client_secret)
token = self.refresh_token(
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/requests-oauthlib-0.7.0/requests_oauthlib.egg-info/PKG-INFO
new/requests-oauthlib-0.8.0/requests_oauthlib.egg-info/PKG-INFO
--- old/requests-oauthlib-0.7.0/requests_oauthlib.egg-info/PKG-INFO
2016-09-22 14:00:03.000000000 +0200
+++ new/requests-oauthlib-0.8.0/requests_oauthlib.egg-info/PKG-INFO
2017-02-14 16:16:59.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: requests-oauthlib
-Version: 0.7.0
+Version: 0.8.0
Summary: OAuthlib authentication support for Requests.
Home-page: https://github.com/requests/requests-oauthlib
Author: Kenneth Reitz
@@ -69,6 +69,17 @@
History
-------
+ v0.8.0 (14 February 2017)
+ +++++++++++++++++++++++++
+
+ - Added Fitbit compliance fix.
+ - Fixed an issue where newlines in the response body for the access
token
+ request would cause errors when trying to extract the token.
+ - Fixed an issue introduced in v0.7.0 where users passing ``auth`` to
several
+ methods would encounter conflicts with the ``client_id`` and
+ ``client_secret``-derived auth. The user-supplied ``auth`` argument
is now
+ used in preference to those options.
+
v0.7.0 (22 September 2016)
++++++++++++++++++++++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/requests-oauthlib-0.7.0/requests_oauthlib.egg-info/SOURCES.txt
new/requests-oauthlib-0.8.0/requests_oauthlib.egg-info/SOURCES.txt
--- old/requests-oauthlib-0.7.0/requests_oauthlib.egg-info/SOURCES.txt
2016-09-22 14:00:04.000000000 +0200
+++ new/requests-oauthlib-0.8.0/requests_oauthlib.egg-info/SOURCES.txt
2017-02-14 16:16:59.000000000 +0100
@@ -20,6 +20,7 @@
docs/examples/google.rst
docs/examples/linkedin.rst
docs/examples/mediawiki.rst
+docs/examples/outlook.rst
docs/examples/real_world_example.rst
docs/examples/real_world_example_with_refresh.rst
docs/examples/tumblr.rst
@@ -37,6 +38,7 @@
requests_oauthlib/compliance_fixes/__init__.py
requests_oauthlib/compliance_fixes/douban.py
requests_oauthlib/compliance_fixes/facebook.py
+requests_oauthlib/compliance_fixes/fitbit.py
requests_oauthlib/compliance_fixes/linkedin.py
requests_oauthlib/compliance_fixes/mailchimp.py
requests_oauthlib/compliance_fixes/slack.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/requests-oauthlib-0.7.0/setup.cfg
new/requests-oauthlib-0.8.0/setup.cfg
--- old/requests-oauthlib-0.7.0/setup.cfg 2016-09-22 14:00:04.000000000
+0200
+++ new/requests-oauthlib-0.8.0/setup.cfg 2017-02-14 16:17:00.000000000
+0100
@@ -4,5 +4,4 @@
[egg_info]
tag_build =
tag_date = 0
-tag_svn_revision = 0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/requests-oauthlib-0.7.0/tests/test_compliance_fixes.py
new/requests-oauthlib-0.8.0/tests/test_compliance_fixes.py
--- old/requests-oauthlib-0.7.0/tests/test_compliance_fixes.py 2016-02-19
16:57:38.000000000 +0100
+++ new/requests-oauthlib-0.8.0/tests/test_compliance_fixes.py 2017-02-14
16:08:57.000000000 +0100
@@ -12,8 +12,10 @@
except ImportError:
from urllib.parse import urlparse, parse_qs
+from oauthlib.oauth2.rfc6749.errors import InvalidGrantError
from requests_oauthlib import OAuth2Session
from requests_oauthlib.compliance_fixes import facebook_compliance_fix
+from requests_oauthlib.compliance_fixes import fitbit_compliance_fix
from requests_oauthlib.compliance_fixes import linkedin_compliance_fix
from requests_oauthlib.compliance_fixes import mailchimp_compliance_fix
from requests_oauthlib.compliance_fixes import weibo_compliance_fix
@@ -44,6 +46,63 @@
self.assertEqual(token, {'access_token': 'urlencoded', 'token_type':
'Bearer'})
+class FitbitComplianceFixTest(TestCase):
+
+ def setUp(self):
+ self.mocker = requests_mock.Mocker()
+ self.mocker.post(
+ "https://api.fitbit.com/oauth2/token",
+ json={"errors": [{"errorType": "invalid_grant"}]},
+ )
+ self.mocker.start()
+ self.addCleanup(self.mocker.stop)
+
+ fitbit = OAuth2Session('foo', redirect_uri='https://i.b')
+ self.session = fitbit_compliance_fix(fitbit)
+
+ def test_fetch_access_token(self):
+ self.assertRaises(
+ InvalidGrantError,
+ self.session.fetch_token,
+ 'https://api.fitbit.com/oauth2/token',
+ client_secret='bar',
+ authorization_response='https://i.b/?code=hello',
+ )
+
+ self.mocker.post(
+ "https://api.fitbit.com/oauth2/token",
+ json={"access_token": "fitbit"},
+ )
+
+ token = self.session.fetch_token(
+ 'https://api.fitbit.com/oauth2/token',
+ client_secret='good'
+ )
+
+ self.assertEqual(token, {'access_token': 'fitbit'})
+
+ def test_refresh_token(self):
+ self.assertRaises(
+ InvalidGrantError,
+ self.session.refresh_token,
+ 'https://api.fitbit.com/oauth2/token',
+ auth=requests.auth.HTTPBasicAuth('foo', 'bar')
+ )
+
+ self.mocker.post(
+ "https://api.fitbit.com/oauth2/token",
+ json={"access_token": "access", "refresh_token": "refresh"},
+ )
+
+ token = self.session.refresh_token(
+ 'https://api.fitbit.com/oauth2/token',
+ auth=requests.auth.HTTPBasicAuth('foo', 'bar')
+ )
+
+ self.assertEqual(token['access_token'], 'access')
+ self.assertEqual(token['refresh_token'], 'refresh')
+
+
class LinkedInComplianceFixTest(TestCase):
def setUp(self):