Skip to content

Commit f6cdfe9

Browse files
authored
Merge branch 'master' into master
2 parents 6712ca2 + ec38f6c commit f6cdfe9

File tree

14 files changed

+105
-30
lines changed

14 files changed

+105
-30
lines changed

.github/workflows/publish-release.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Publish Tags on PyPi when GitHub creates a release
2+
on:
3+
push:
4+
tags:
5+
- 'v**'
6+
jobs:
7+
publish:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
- name: Set up Python 3.9
12+
uses: actions/setup-python@v2
13+
with:
14+
python-version: 3.9
15+
- name: Install upload dependencies
16+
run: |
17+
python -m pip install --upgrade pip setuptools wheel twine
18+
- name: Build and publish
19+
env:
20+
TWINE_USERNAME: __token__
21+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
22+
run: |
23+
python setup.py sdist bdist_wheel
24+
twine upload dist/*

AUTHORS.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@ Patches and Suggestions
2222
- Vinay Raikar <rockraikar@gmail.com>
2323
- kracekumar <me@kracekumar.com>
2424
- David Baumgold <david@davidbaumgold.com>
25+
- Sylvain Marie <sylvain.marie@se.com>
2526
- Craig Anderson <craiga@craiga.id.au>
2627
- Hugo van Kemenade <https://github.com/hugovk>

HISTORY.rst

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,28 @@
11
History
22
-------
33

4-
UNRELEASED
5-
++++++++++
4+
v1.4.0 (TBD)
5+
++++++++++++++++++++++++
6+
- ``OAuth2Session`` now correctly uses the ``self.verify`` value if ``verify``
7+
is not overridden in ``fetch_token`` and ``refresh_token``. Fixes `#404
8+
<https://github.com/requests/requests-oauthlib/issues/404>`_.
9+
- ``OAuth2Session`` constructor now uses its ``client.scope`` when a ``client``
10+
is provided and ``scope`` is not overridden. Fixes `#408
11+
<https://github.com/requests/requests-oauthlib/issues/408>`_
12+
- Add support for Python 3.8-3.10
13+
14+
15+
v1.3.1 (21 January 2022)
16+
++++++++++++++++++++++++
617

718
- Add initial support for OAuth Mutual TLS (draft-ietf-oauth-mtls)
819
- Removed outdated LinkedIn Compliance Fixes
9-
- Add support for Python 3.8-3.10
20+
- Add eBay compliance fix
21+
- Add Spotify OAuth 2 Tutorial
22+
- Add support for python 3.8, 3.9
23+
- Fixed LinkedIn Compliance Fixes
24+
- Fixed ReadTheDocs Documentation and sphinx errors
25+
- Moved pipeline to GitHub Actions
1026

1127
v1.3.0 (6 November 2019)
1228
++++++++++++++++++++++++

docs/conf.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
master_doc = "index"
4242

4343
# General information about the project.
44-
project = u"Requests-OAuthlib"
45-
copyright = u"2014, Kenneth Reitz"
44+
project = "Requests-OAuthlib"
45+
copyright = "2014, Kenneth Reitz"
4646

4747
# The version info for the project you're documenting, acts as replacement for
4848
# |version| and |release|, also used in various other places throughout the
@@ -188,8 +188,8 @@
188188
(
189189
"index",
190190
"Requests-OAuthlib.tex",
191-
u"Requests-OAuthlib Documentation",
192-
u"Requests-OAuthlib Contributors",
191+
"Requests-OAuthlib Documentation",
192+
"Requests-OAuthlib Contributors",
193193
"manual",
194194
)
195195
]
@@ -223,8 +223,8 @@
223223
(
224224
"index",
225225
"requests-oauthlib",
226-
u"Requests-OAuthlib Documentation",
227-
[u"Requests-OAuthlib Contributors"],
226+
"Requests-OAuthlib Documentation",
227+
["Requests-OAuthlib Contributors"],
228228
1,
229229
)
230230
]
@@ -242,8 +242,8 @@
242242
(
243243
"index",
244244
"Requests-OAuthlib",
245-
u"Requests-OAuthlib Documentation",
246-
u"Requests-OAuthlib Contributors",
245+
"Requests-OAuthlib Documentation",
246+
"Requests-OAuthlib Contributors",
247247
"Requests-OAuthlib",
248248
"One line description of project.",
249249
"Miscellaneous",

docs/contributing.rst

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,27 @@ In order to run successfully, you will need all versions of Python installed. We
4848
$ pyenv install pypy2.7-7.1.1
4949
$ pyenv install pypy3.6-7.1.1
5050

51+
52+
Publishing a release (for maintainer role)
53+
==========================================
54+
55+
Maintainer tasks should always be kept to minimum. Once a release is ready, the suggested approach can be followed:
56+
57+
#. Create new branch release-X.Y.Z
58+
#. Update the HISTORY.rst file
59+
#. Update the `request_oauthlib/__init__.py`
60+
#. Raise a pull request to give a chance for all contributors to comment before publishing
61+
#. Create a TAG vX.Y.Z. By doing this, the pipeline will automatically trigger `twine` and will publish the release to PyPi.
62+
63+
Once verified, complete by doing the following:
64+
65+
#. Create a GitHub release vX.Y.Z in the Releases tab.
66+
#. Activate the vX.Y.Z version in the documentation (`ReadTheDocs`_)
67+
#. Merge the PR into master branch.
68+
69+
That's all.
70+
5171
.. _`tox`: https://tox.readthedocs.io/en/latest/install.html
5272
.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/installation/
5373
.. _`pyenv`: https://github.com/pyenv/pyenv
54-
74+
.. _`ReadTheDocs`: https://readthedocs.org/projects/requests-oauthlib/versions/

docs/examples/outlook.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ Create a new web application client in the `Microsoft Application Registration P
55
When you have obtained a ``client_id``, ``client_secret`` and registered
66
a callback URL then you can try out the command line interactive example below.
77

8-
.. _`Outlook App console`: https://apps.dev.microsoft.com
98
.. _`Microsoft Application Registration Portal`: https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationsListBlade
109

1110
.. code-block:: pycon

requests_oauthlib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from .oauth2_auth import OAuth2
66
from .oauth2_session import OAuth2Session, TokenUpdated
77

8-
__version__ = "1.3.0"
8+
__version__ = "1.3.1"
99

1010
import requests
1111

requests_oauthlib/oauth1_session.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ def authorization_url(self, url, request_token=None, **kwargs):
258258
return add_params_to_uri(url, kwargs.items())
259259

260260
def fetch_request_token(self, url, realm=None, **request_kwargs):
261-
r"""Fetch a request token.
261+
"""Fetch a request token.
262262
263263
This is the first step in the OAuth 1 workflow. A request token is
264264
obtained by making a signed post request to url. The token is then
@@ -267,7 +267,7 @@ def fetch_request_token(self, url, realm=None, **request_kwargs):
267267
268268
:param url: The request token endpoint URL.
269269
:param realm: A list of realms to request access to.
270-
:param \*\*request_kwargs: Optional arguments passed to ''post''
270+
:param request_kwargs: Optional arguments passed to ''post''
271271
function in ''requests.Session''
272272
:returns: The response in dict format.
273273

requests_oauthlib/oauth2_session.py

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def __init__(
7777
super(OAuth2Session, self).__init__(**kwargs)
7878
self._client = client or WebApplicationClient(client_id, token=token)
7979
self.token = token or {}
80-
self.scope = scope
80+
self._scope = scope
8181
self.redirect_uri = redirect_uri
8282
self.state = state or generate_token
8383
self._state = state
@@ -97,6 +97,20 @@ def __init__(
9797
"protected_request": set(),
9898
}
9999

100+
@property
101+
def scope(self):
102+
"""By default the scope from the client is used, except if overridden"""
103+
if self._scope is not None:
104+
return self._scope
105+
elif self._client is not None:
106+
return self._client.scope
107+
else:
108+
return None
109+
110+
@scope.setter
111+
def scope(self, scope):
112+
self._scope = scope
113+
100114
def new_state(self):
101115
"""Generates a state string to be used in authorizations."""
102116
try:
@@ -185,7 +199,7 @@ def fetch_token(
185199
force_querystring=False,
186200
timeout=None,
187201
headers=None,
188-
verify=True,
202+
verify=None,
189203
proxies=None,
190204
include_client_id=None,
191205
client_secret=None,
@@ -325,7 +339,7 @@ def fetch_token(
325339

326340
headers = headers or {
327341
"Accept": "application/json",
328-
"Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
342+
"Content-Type": "application/x-www-form-urlencoded",
329343
}
330344
self.token = {}
331345
request_kwargs = {}
@@ -388,7 +402,7 @@ def refresh_token(
388402
auth=None,
389403
timeout=None,
390404
headers=None,
391-
verify=True,
405+
verify=None,
392406
proxies=None,
393407
**kwargs
394408
):
@@ -426,7 +440,7 @@ def refresh_token(
426440
if headers is None:
427441
headers = {
428442
"Accept": "application/json",
429-
"Content-Type": ("application/x-www-form-urlencoded;charset=UTF-8"),
443+
"Content-Type": ("application/x-www-form-urlencoded"),
430444
}
431445

432446
r = self.post(
@@ -464,6 +478,7 @@ def request(
464478
withhold_token=False,
465479
client_id=None,
466480
client_secret=None,
481+
files=None,
467482
**kwargs
468483
):
469484
"""Intercept all requests and add the OAuth 2 token if present."""
@@ -519,7 +534,7 @@ def request(
519534
log.debug("Supplying headers %s and data %s", headers, data)
520535
log.debug("Passing through key word arguments %s.", kwargs)
521536
return super(OAuth2Session, self).request(
522-
method, url, headers=headers, data=data, **kwargs
537+
method, url, headers=headers, data=data, files=files, **kwargs
523538
)
524539

525540
def register_compliance_hook(self, hook_type, hook):

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,6 @@ def readall(path):
6767
"Programming Language :: Python :: Implementation :: PyPy",
6868
],
6969
zip_safe=False,
70-
tests_require=["mock", "requests-mock"],
70+
tests_require=['mock;python_version<"3.3"', "requests-mock"],
7171
test_suite="tests",
7272
)

0 commit comments

Comments
 (0)