Codebase list google-auth-oauthlib / upstream/0.4.6+git20210901.1.fc7023c
Import upstream version 0.4.6+git20210901.1.fc7023c Debian Janitor 2 years ago
10 changed file(s) with 84 addition(s) and 35 deletion(s). Raw diff Collapse all Expand all
0 Apache License
0
1 Apache License
12 Version 2.0, January 2004
2 https://www.apache.org/licenses/
3 http://www.apache.org/licenses/
34
45 TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
56
191192 you may not use this file except in compliance with the License.
192193 You may obtain a copy of the License at
193194
194 https://www.apache.org/licenses/LICENSE-2.0
195 http://www.apache.org/licenses/LICENSE-2.0
195196
196197 Unless required by applicable law or agreed to in writing, software
197198 distributed under the License is distributed on an "AS IS" BASIS,
1515
1616 # Generated by synthtool. DO NOT EDIT!
1717 include README.rst LICENSE
18 recursive-include google *.json *.proto
18 recursive-include google *.json *.proto py.typed
1919 recursive-include tests *
2020 global-exclude *.py[co]
2121 global-exclude __pycache__
2222
2323 # Exclude scripts for samples readmegen
24 prune scripts/readme-gen
24 prune scripts/readme-gen
00 Metadata-Version: 2.1
11 Name: google-auth-oauthlib
2 Version: 0.4.2
2 Version: 0.4.6
33 Summary: Google Authentication Library
44 Home-page: https://github.com/GoogleCloudPlatform/google-auth-library-python-oauthlib
55 Author: Google Cloud Platform
1212
1313 This library provides `oauthlib`_ integration with `google-auth`_.
1414
15 .. |build| image:: https://travis-ci.org/googleapis/google-auth-library-python-oauthlib.svg?branch=master
15 .. |build| image:: https://travis-ci.org/googleapis/google-auth-library-python-oauthlib.svg?branch=main
1616 :target: https://travis-ci.org/googleapis/google-auth-library-python-oauthlib
1717 .. |docs| image:: https://readthedocs.org/projects/google-auth-oauthlib/badge/?version=latest
1818 :target: https://google-auth-oauthlib.readthedocs.io/en/latest/
3838
3939 .. _google-auth-oauthlib.readthedocs.io: http://google-auth-oauthlib.readthedocs.io/
4040
41 Supported Python Versions
42 -------------------------
43 Python >= 3.6
44
45
46 Unsupported Python Versions
47 ---------------------------
48
49 Python == 2.7, Python == 3.5.
50
51 The last version of this library compatible with Python 2.7 and 3.5 is
52 `google-auth-oauthlib==0.4.1`.
53
4154 License
4255 -------
4356
4457 Apache 2.0 - See `the LICENSE`_ for more information.
4558
46 .. _the LICENSE: https://github.com/googleapis/google-auth-library-python-oauthlib/blob/master/LICENSE
59 .. _the LICENSE: https://github.com/googleapis/google-auth-library-python-oauthlib/blob/main/LICENSE
4760
4861 Keywords: google auth oauth client oauthlib
4962 Platform: UNKNOWN
44
55 This library provides `oauthlib`_ integration with `google-auth`_.
66
7 .. |build| image:: https://travis-ci.org/googleapis/google-auth-library-python-oauthlib.svg?branch=master
7 .. |build| image:: https://travis-ci.org/googleapis/google-auth-library-python-oauthlib.svg?branch=main
88 :target: https://travis-ci.org/googleapis/google-auth-library-python-oauthlib
99 .. |docs| image:: https://readthedocs.org/projects/google-auth-oauthlib/badge/?version=latest
1010 :target: https://google-auth-oauthlib.readthedocs.io/en/latest/
3030
3131 .. _google-auth-oauthlib.readthedocs.io: http://google-auth-oauthlib.readthedocs.io/
3232
33 Supported Python Versions
34 -------------------------
35 Python >= 3.6
36
37
38 Unsupported Python Versions
39 ---------------------------
40
41 Python == 2.7, Python == 3.5.
42
43 The last version of this library compatible with Python 2.7 and 3.5 is
44 `google-auth-oauthlib==0.4.1`.
45
3346 License
3447 -------
3548
3649 Apache 2.0 - See `the LICENSE`_ for more information.
3750
38 .. _the LICENSE: https://github.com/googleapis/google-auth-library-python-oauthlib/blob/master/LICENSE
51 .. _the LICENSE: https://github.com/googleapis/google-auth-library-python-oauthlib/blob/main/LICENSE
6666
6767 import google.auth.transport.requests
6868 import google.oauth2.credentials
69 from six.moves import input
7069
7170 import google_auth_oauthlib.helpers
7271
8786 from the `Google API Console`_.
8887
8988 .. _client secrets file:
90 https://developers.google.com/identity/protocols/OAuth2WebServer
89 https://developers.google.com/identity/protocols/oauth2/web-server
9190 #creatingcred
9291 .. _Google API Console:
9392 https://console.developers.google.com/apis/credentials
118117 autogenerate_code_verifier (bool): If true, auto-generate a
119118 code_verifier.
120119 .. _client secrets:
121 https://developers.google.com/api-client-library/python/guide
122 /aaa_client_secrets
120 https://github.com/googleapis/google-api-python-client/blob
121 /main/docs/client-secrets.md
123122 """
124123 self.client_type = client_type
125124 """str: The client type, either ``'web'`` or ``'installed'``"""
152151 format.
153152
154153 .. _client secrets:
155 https://developers.google.com/api-client-library/python/guide
156 /aaa_client_secrets
154 https://github.com/googleapis/google-api-python-client/blob/main/docs/client-secrets.md
157155 """
158156 if "web" in client_config:
159157 client_type = "web"
356354 response, such as using an embedded web view.
357355
358356 .. _Installed Application Authorization Flow:
359 https://developers.google.com/api-client-library/python/auth
360 /installed-app
357 https://github.com/googleapis/google-api-python-client/blob/main/docs/oauth-installed.md
361358 """
362359
363360 _OOB_REDIRECT_URI = "urn:ietf:wg:oauth:2.0:oob"
421418 authorization_prompt_message=_DEFAULT_AUTH_PROMPT_MESSAGE,
422419 success_message=_DEFAULT_WEB_SUCCESS_MESSAGE,
423420 open_browser=True,
421 redirect_uri_trailing_slash=True,
424422 **kwargs
425423 ):
426424 """Run the flow using the server strategy.
443441 the authorization flow is complete.
444442 open_browser (bool): Whether or not to open the authorization URL
445443 in the user's browser.
444 redirect_uri_trailing_slash (bool): whether or not to add trailing
445 slash when constructing the redirect_uri. Default value is True.
446446 kwargs: Additional keyword arguments passed through to
447447 :meth:`authorization_url`.
448448
457457 host, port, wsgi_app, handler_class=_WSGIRequestHandler
458458 )
459459
460 self.redirect_uri = "http://{}:{}/".format(host, local_server.server_port)
460 redirect_uri_format = (
461 "http://{}:{}/" if redirect_uri_trailing_slash else "http://{}:{}"
462 )
463 self.redirect_uri = redirect_uri_format.format(host, local_server.server_port)
461464 auth_url, _ = self.authorization_url(**kwargs)
462465
463466 if open_browser:
516519 Returns:
517520 Iterable[bytes]: The response body.
518521 """
519 start_response("200 OK", [("Content-type", "text/plain")])
522 start_response("200 OK", [("Content-type", "text/plain; charset=utf-8")])
520523 self.last_request_uri = wsgiref.util.request_uri(environ)
521524 return [self._success_message.encode("utf-8")]
5050 oauthlib session and the validated client configuration.
5151
5252 .. _client secrets:
53 https://developers.google.com/api-client-library/python/guide
54 /aaa_client_secrets
53 https://github.com/googleapis/google-api-python-client/blob/main/docs/client-secrets.md
5554 """
5655
5756 if "web" in client_config:
8887 oauthlib session and the validated client configuration.
8988
9089 .. _client secrets:
91 https://developers.google.com/api-client-library/python/guide
92 /aaa_client_secrets
90 https://github.com/googleapis/google-api-python-client/blob/main/docs/client-secrets.md
9391 """
9492 with open(client_secrets_file, "r") as json_file:
9593 client_config = json.load(json_file)
00 Metadata-Version: 2.1
11 Name: google-auth-oauthlib
2 Version: 0.4.2
2 Version: 0.4.6
33 Summary: Google Authentication Library
44 Home-page: https://github.com/GoogleCloudPlatform/google-auth-library-python-oauthlib
55 Author: Google Cloud Platform
1212
1313 This library provides `oauthlib`_ integration with `google-auth`_.
1414
15 .. |build| image:: https://travis-ci.org/googleapis/google-auth-library-python-oauthlib.svg?branch=master
15 .. |build| image:: https://travis-ci.org/googleapis/google-auth-library-python-oauthlib.svg?branch=main
1616 :target: https://travis-ci.org/googleapis/google-auth-library-python-oauthlib
1717 .. |docs| image:: https://readthedocs.org/projects/google-auth-oauthlib/badge/?version=latest
1818 :target: https://google-auth-oauthlib.readthedocs.io/en/latest/
3838
3939 .. _google-auth-oauthlib.readthedocs.io: http://google-auth-oauthlib.readthedocs.io/
4040
41 Supported Python Versions
42 -------------------------
43 Python >= 3.6
44
45
46 Unsupported Python Versions
47 ---------------------------
48
49 Python == 2.7, Python == 3.5.
50
51 The last version of this library compatible with Python 2.7 and 3.5 is
52 `google-auth-oauthlib==0.4.1`.
53
4154 License
4255 -------
4356
4457 Apache 2.0 - See `the LICENSE`_ for more information.
4558
46 .. _the LICENSE: https://github.com/googleapis/google-auth-library-python-oauthlib/blob/master/LICENSE
59 .. _the LICENSE: https://github.com/googleapis/google-auth-library-python-oauthlib/blob/main/LICENSE
4760
4861 Keywords: google auth oauth client oauthlib
4962 Platform: UNKNOWN
0 google-auth
0 google-auth>=1.0.0
11 requests-oauthlib>=0.7.0
22
33 [tool]
4 click
4 click>=6.0.0
1717 from setuptools import setup
1818
1919
20 TOOL_DEPENDENCIES = "click"
20 TOOL_DEPENDENCIES = "click>=6.0.0"
2121
22 DEPENDENCIES = ("google-auth", "requests-oauthlib>=0.7.0")
22 DEPENDENCIES = ("google-auth>=1.0.0", "requests-oauthlib>=0.7.0")
2323
2424
2525 with io.open("README.rst", "r") as fh:
2626 long_description = fh.read()
2727
2828
29 version = "0.4.2"
29 version = "0.4.6"
3030
3131 setup(
3232 name="google-auth-oauthlib",
2323 import mock
2424 import pytest
2525 import requests
26 from six.moves import urllib
26 import urllib
2727
2828 from google_auth_oauthlib import flow
2929
281281 with fetch_token_patch as fetch_token_mock:
282282 yield fetch_token_mock
283283
284 @mock.patch("google_auth_oauthlib.flow.input", autospec=True)
284 @mock.patch("builtins.input", autospec=True)
285285 def test_run_console(self, input_mock, instance, mock_fetch_token):
286286 input_mock.return_value = mock.sentinel.code
287287 instance.code_verifier = "amanaplanacanalpanama"
320320 assert credentials._refresh_token == mock.sentinel.refresh_token
321321 assert credentials.id_token == mock.sentinel.id_token
322322 assert webbrowser_mock.open.called
323 assert instance.redirect_uri == f"http://localhost:{port}/"
323324
324325 expected_auth_response = auth_redirect_url.replace("http", "https")
325326 mock_fetch_token.assert_called_with(
340341 instance.code_verifier = "amanaplanacanalpanama"
341342
342343 with concurrent.futures.ThreadPoolExecutor(max_workers=1) as pool:
343 future = pool.submit(partial(instance.run_local_server, port=port))
344 future = pool.submit(
345 partial(
346 instance.run_local_server,
347 port=port,
348 redirect_uri_trailing_slash=False,
349 )
350 )
344351
345352 while not future.done():
346353 try:
354361 assert credentials._refresh_token == mock.sentinel.refresh_token
355362 assert credentials.id_token == mock.sentinel.id_token
356363 assert webbrowser_mock.open.called
364 assert instance.redirect_uri == f"http://localhost:{port}"
357365
358366 expected_auth_response = auth_redirect_url.replace("http", "https")
359367 mock_fetch_token.assert_called_with(