python-service-builder 1.0.0__tar.gz → 1.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (15) hide show
  1. {python-service-builder-1.0.0 → python-service-builder-1.0.2}/PKG-INFO +15 -1
  2. {python-service-builder-1.0.0 → python-service-builder-1.0.2}/pyproject.toml +1 -1
  3. {python-service-builder-1.0.0 → python-service-builder-1.0.2}/python_service_builder.egg-info/PKG-INFO +15 -1
  4. {python-service-builder-1.0.0 → python-service-builder-1.0.2}/service_framework/service_builder.py +7 -25
  5. {python-service-builder-1.0.0 → python-service-builder-1.0.2}/service_framework/services.py +1 -0
  6. {python-service-builder-1.0.0 → python-service-builder-1.0.2}/README.md +0 -0
  7. {python-service-builder-1.0.0 → python-service-builder-1.0.2}/python_service_builder.egg-info/SOURCES.txt +0 -0
  8. {python-service-builder-1.0.0 → python-service-builder-1.0.2}/python_service_builder.egg-info/dependency_links.txt +0 -0
  9. {python-service-builder-1.0.0 → python-service-builder-1.0.2}/python_service_builder.egg-info/requires.txt +0 -0
  10. {python-service-builder-1.0.0 → python-service-builder-1.0.2}/python_service_builder.egg-info/top_level.txt +0 -0
  11. {python-service-builder-1.0.0 → python-service-builder-1.0.2}/service_framework/__init__.py +0 -0
  12. {python-service-builder-1.0.0 → python-service-builder-1.0.2}/service_framework/__init_test.py +0 -0
  13. {python-service-builder-1.0.0 → python-service-builder-1.0.2}/service_framework/list_services.py +0 -0
  14. {python-service-builder-1.0.0 → python-service-builder-1.0.2}/service_framework/services_test.py +0 -0
  15. {python-service-builder-1.0.0 → python-service-builder-1.0.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-service-builder
3
- Version: 1.0.0
3
+ Version: 1.0.2
4
4
  Summary: Helper library for easier creation of Google services.
5
5
  Author-email: David Harcombe <david.harcombe@gmail.com>
6
6
  License: Apache 2.0
@@ -10,6 +10,20 @@ Classifier: Programming Language :: Python :: 3
10
10
  Classifier: Operating System :: OS Independent
11
11
  Requires-Python: >=3.10
12
12
  Description-Content-Type: text/markdown
13
+ Requires-Dist: absl-py>=0.12.0
14
+ Requires-Dist: dataclasses-json>=0.5.2
15
+ Requires-Dist: gcs-oauth2-boto-plugin>=2.7
16
+ Requires-Dist: google-api-core>=1.26.1
17
+ Requires-Dist: google-api-python-client>=2.0.2
18
+ Requires-Dist: google-auth-httplib2>=0.1.0
19
+ Requires-Dist: google-auth-oauthlib>=0.4.3
20
+ Requires-Dist: google-auth>=1.28.0
21
+ Requires-Dist: google-reauth>=0.1.1
22
+ Requires-Dist: googleapis-common-protos>=1.53.0
23
+ Requires-Dist: httplib2>=0.19.0
24
+ Requires-Dist: immutabledict>=2.2.1
25
+ Requires-Dist: oauth2client>=4.1.3
26
+ Requires-Dist: oauthlib>=3.1.0
13
27
 
14
28
  # Python Library for helping to create Python services from Google APIs
15
29
 
@@ -4,7 +4,7 @@ build-backend = 'setuptools.build_meta'
4
4
 
5
5
  [project]
6
6
  name = "python-service-builder"
7
- version = "1.0.0"
7
+ version = "1.0.2"
8
8
  authors = [{ name = "David Harcombe", email = "david.harcombe@gmail.com" }]
9
9
  description = "Helper library for easier creation of Google services."
10
10
  readme = "README.md"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: python-service-builder
3
- Version: 1.0.0
3
+ Version: 1.0.2
4
4
  Summary: Helper library for easier creation of Google services.
5
5
  Author-email: David Harcombe <david.harcombe@gmail.com>
6
6
  License: Apache 2.0
@@ -10,6 +10,20 @@ Classifier: Programming Language :: Python :: 3
10
10
  Classifier: Operating System :: OS Independent
11
11
  Requires-Python: >=3.10
12
12
  Description-Content-Type: text/markdown
13
+ Requires-Dist: absl-py>=0.12.0
14
+ Requires-Dist: dataclasses-json>=0.5.2
15
+ Requires-Dist: gcs-oauth2-boto-plugin>=2.7
16
+ Requires-Dist: google-api-core>=1.26.1
17
+ Requires-Dist: google-api-python-client>=2.0.2
18
+ Requires-Dist: google-auth-httplib2>=0.1.0
19
+ Requires-Dist: google-auth-oauthlib>=0.4.3
20
+ Requires-Dist: google-auth>=1.28.0
21
+ Requires-Dist: google-reauth>=0.1.1
22
+ Requires-Dist: googleapis-common-protos>=1.53.0
23
+ Requires-Dist: httplib2>=0.19.0
24
+ Requires-Dist: immutabledict>=2.2.1
25
+ Requires-Dist: oauth2client>=4.1.3
26
+ Requires-Dist: oauthlib>=3.1.0
13
27
 
14
28
  # Python Library for helping to create Python services from Google APIs
15
29
 
@@ -28,12 +28,13 @@ from google.auth import exceptions
28
28
  from google.oauth2 import credentials as oauth
29
29
  from httplib2 import Http
30
30
  from oauth2client import service_account
31
+ from oauth2client import client
31
32
 
32
33
  from service_framework.services import Service
33
34
  from service_framework import snake_field
34
35
 
35
36
 
36
- @dataclasses_json.dataclass_json
37
+ @dataclasses_json.dataclass_json(undefined=dataclasses_json.Undefined.EXCLUDE)
37
38
  @dataclasses.dataclass
38
39
  class OAuthKey(object):
39
40
  """Dataclass from the json key.
@@ -75,22 +76,10 @@ def build_service(service: Service,
75
76
  if extra_scopes:
76
77
  kwargs['scopes'] = extra_scopes
77
78
 
78
- try:
79
- credentials = oauth.Credentials(**kwargs)
80
- https = google_auth_httplib2.AuthorizedHttp(credentials)
81
-
82
- except KeyError:
83
- logging.exception(
84
- 'Invalid credentials received: missing a part of the credentials')
85
- raise
86
-
87
- except exceptions.RefreshError as error:
88
- logging.exception('Invalid credentials received')
89
- raise
79
+ credentials = oauth.Credentials(**kwargs)
90
80
 
91
81
  elif isinstance(key, oauth.Credentials):
92
82
  credentials = key
93
- https = google_auth_httplib2.AuthorizedHttp(credentials)
94
83
 
95
84
  elif isinstance(key, str):
96
85
  kwargs = {
@@ -99,27 +88,20 @@ def build_service(service: Service,
99
88
  if extra_scopes:
100
89
  kwargs['scopes'] = extra_scopes
101
90
 
102
- credentials = \
103
- service_account.ServiceAccountCredentials.from_json_keyfile_name(
104
- **kwargs)
105
- https = credentials.authorize(Http())
91
+ credentials = oauth.Credentials.from_authorized_user_file(**kwargs)
106
92
 
107
93
  elif isinstance(key, Mapping):
108
- kwargs = {
109
- 'keyfile_dict': key,
110
- }
94
+ kwargs = OAuthKey(**key).to_dict()
111
95
 
112
96
  if extra_scopes:
113
97
  kwargs['scopes'] = extra_scopes
114
98
 
115
- credentials = \
116
- service_account.ServiceAccountCredentials.from_json_keyfile_dict(
117
- key, scopes=extra_scopes)
118
- https = credentials.authorize(Http())
99
+ credentials = oauth.Credentials(**kwargs)
119
100
 
120
101
  else:
121
102
  raise Exception('No valid credentials provided.')
122
103
 
104
+ https = google_auth_httplib2.AuthorizedHttp(credentials)
123
105
  discovery_args = {
124
106
  'http': https,
125
107
  'developerKey': api_key,
@@ -322,6 +322,7 @@ SERVICE_DEFINITIONS = \
322
322
  'WEBSECURITYSCANNER': ('websecurityscanner', 'v1'),
323
323
  'WORKFLOWEXECUTIONS': ('workflowexecutions', 'v1'),
324
324
  'WORKFLOWS': ('workflows', 'v1'),
325
+ 'WORKSPACEEVENTS': {'workspaceevents', 'v1'},
325
326
  'YOUTUBE': ('youtube', 'v3'),
326
327
  'YOUTUBEANALYTICS': ('youtubeAnalytics', 'v2'),
327
328
  'YOUTUBEREPORTING': ('youtubereporting', 'v1')})