gam7 7.3.4__py3-none-any.whl

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.

Potentially problematic release.


This version of gam7 might be problematic. Click here for more details.

Files changed (72) hide show
  1. gam/__init__.py +77555 -0
  2. gam/__main__.py +40 -0
  3. gam/atom/__init__.py +1460 -0
  4. gam/atom/auth.py +41 -0
  5. gam/atom/client.py +214 -0
  6. gam/atom/core.py +535 -0
  7. gam/atom/data.py +327 -0
  8. gam/atom/http.py +354 -0
  9. gam/atom/http_core.py +599 -0
  10. gam/atom/http_interface.py +144 -0
  11. gam/atom/mock_http.py +123 -0
  12. gam/atom/mock_http_core.py +313 -0
  13. gam/atom/mock_service.py +235 -0
  14. gam/atom/service.py +723 -0
  15. gam/atom/token_store.py +105 -0
  16. gam/atom/url.py +130 -0
  17. gam/cacerts.pem +1130 -0
  18. gam/cbcm-v1.1beta1.json +593 -0
  19. gam/contactdelegation-v1.json +249 -0
  20. gam/datastudio-v1.json +486 -0
  21. gam/gamlib/__init__.py +17 -0
  22. gam/gamlib/glaction.py +308 -0
  23. gam/gamlib/glapi.py +837 -0
  24. gam/gamlib/glcfg.py +616 -0
  25. gam/gamlib/glclargs.py +1184 -0
  26. gam/gamlib/glentity.py +831 -0
  27. gam/gamlib/glgapi.py +817 -0
  28. gam/gamlib/glgdata.py +98 -0
  29. gam/gamlib/glglobals.py +307 -0
  30. gam/gamlib/glindent.py +46 -0
  31. gam/gamlib/glmsgs.py +547 -0
  32. gam/gamlib/glskus.py +246 -0
  33. gam/gamlib/gluprop.py +279 -0
  34. gam/gamlib/glverlibs.py +33 -0
  35. gam/gamlib/yubikey.py +202 -0
  36. gam/gdata/__init__.py +825 -0
  37. gam/gdata/alt/__init__.py +20 -0
  38. gam/gdata/alt/app_engine.py +101 -0
  39. gam/gdata/alt/appengine.py +321 -0
  40. gam/gdata/apps/__init__.py +526 -0
  41. gam/gdata/apps/audit/__init__.py +1 -0
  42. gam/gdata/apps/audit/service.py +278 -0
  43. gam/gdata/apps/contacts/__init__.py +874 -0
  44. gam/gdata/apps/contacts/service.py +355 -0
  45. gam/gdata/apps/service.py +544 -0
  46. gam/gdata/apps/sites/__init__.py +283 -0
  47. gam/gdata/apps/sites/service.py +246 -0
  48. gam/gdata/service.py +1714 -0
  49. gam/gdata/urlfetch.py +247 -0
  50. gam/googleapiclient/__init__.py +27 -0
  51. gam/googleapiclient/_auth.py +167 -0
  52. gam/googleapiclient/_helpers.py +207 -0
  53. gam/googleapiclient/channel.py +315 -0
  54. gam/googleapiclient/discovery.py +1662 -0
  55. gam/googleapiclient/discovery_cache/__init__.py +78 -0
  56. gam/googleapiclient/discovery_cache/appengine_memcache.py +55 -0
  57. gam/googleapiclient/discovery_cache/base.py +46 -0
  58. gam/googleapiclient/discovery_cache/file_cache.py +145 -0
  59. gam/googleapiclient/errors.py +197 -0
  60. gam/googleapiclient/http.py +1962 -0
  61. gam/googleapiclient/mimeparse.py +183 -0
  62. gam/googleapiclient/model.py +429 -0
  63. gam/googleapiclient/schema.py +317 -0
  64. gam/googleapiclient/version.py +15 -0
  65. gam/iso8601/__init__.py +28 -0
  66. gam/iso8601/iso8601.py +160 -0
  67. gam/serviceaccountlookup-v1.json +141 -0
  68. gam/six.py +982 -0
  69. gam7-7.3.4.dist-info/METADATA +69 -0
  70. gam7-7.3.4.dist-info/RECORD +72 -0
  71. gam7-7.3.4.dist-info/WHEEL +4 -0
  72. gam7-7.3.4.dist-info/licenses/LICENSE +201 -0
gam/atom/auth.py ADDED
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env python
2
+ #
3
+ # Copyright (C) 2009 Google Inc.
4
+ #
5
+ # Licensed under the Apache License 2.0;
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+
18
+ # This module is used for version 2 of the Google Data APIs.
19
+
20
+
21
+ # __author__ = 'j.s@google.com (Jeff Scudder)'
22
+
23
+ import base64
24
+
25
+
26
+ class BasicAuth(object):
27
+ """Sets the Authorization header as defined in RFC1945"""
28
+
29
+ def __init__(self, user_id, password):
30
+ self.basic_cookie = base64.encodestring(
31
+ '%s:%s' % (user_id, password)).strip()
32
+
33
+ def modify_request(self, http_request):
34
+ http_request.headers['Authorization'] = 'Basic %s' % self.basic_cookie
35
+
36
+ ModifyRequest = modify_request
37
+
38
+
39
+ class NoAuth(object):
40
+ def modify_request(self, http_request):
41
+ pass
gam/atom/client.py ADDED
@@ -0,0 +1,214 @@
1
+ #!/usr/bin/env python
2
+ #
3
+ # Copyright (C) 2009 Google Inc.
4
+ #
5
+ # Licensed under the Apache License 2.0;
6
+
7
+
8
+
9
+ """AtomPubClient provides CRUD ops. in line with the Atom Publishing Protocol.
10
+
11
+ """
12
+
13
+ # __author__ = 'j.s@google.com (Jeff Scudder)'
14
+
15
+ import atom.http_core
16
+
17
+
18
+ class Error(Exception):
19
+ pass
20
+
21
+
22
+ class MissingHost(Error):
23
+ pass
24
+
25
+
26
+ class AtomPubClient(object):
27
+ host = None
28
+ auth_token = None
29
+ ssl = False # Whether to force all requests over https
30
+ xoauth_requestor_id = None
31
+
32
+ def __init__(self, http_client=None, host=None, auth_token=None, source=None,
33
+ xoauth_requestor_id=None, **kwargs):
34
+ """Creates a new AtomPubClient instance.
35
+
36
+ Args:
37
+ source: The name of your application.
38
+ http_client: An object capable of performing HTTP requests through a
39
+ request method. This object is used to perform the request
40
+ when the AtomPubClient's request method is called. Used to
41
+ allow HTTP requests to be directed to a mock server, or use
42
+ an alternate library instead of the default of httplib to
43
+ make HTTP requests.
44
+ host: str The default host name to use if a host is not specified in the
45
+ requested URI.
46
+ auth_token: An object which sets the HTTP Authorization header when its
47
+ modify_request method is called.
48
+ """
49
+ self.http_client = http_client or atom.http_core.ProxiedHttpClient()
50
+ if host is not None:
51
+ self.host = host
52
+ if auth_token is not None:
53
+ self.auth_token = auth_token
54
+ self.xoauth_requestor_id = xoauth_requestor_id
55
+ self.source = source
56
+
57
+ def request(self, method=None, uri=None, auth_token=None,
58
+ http_request=None, **kwargs):
59
+ """Performs an HTTP request to the server indicated.
60
+
61
+ Uses the http_client instance to make the request.
62
+
63
+ Args:
64
+ method: The HTTP method as a string, usually one of 'GET', 'POST',
65
+ 'PUT', or 'DELETE'
66
+ uri: The URI desired as a string or atom.http_core.Uri.
67
+ http_request:
68
+ auth_token: An authorization token object whose modify_request method
69
+ sets the HTTP Authorization header.
70
+
71
+ Returns:
72
+ The results of calling self.http_client.request. With the default
73
+ http_client, this is an HTTP response object.
74
+ """
75
+ # Modify the request based on the AtomPubClient settings and parameters
76
+ # passed in to the request.
77
+ http_request = self.modify_request(http_request)
78
+ if isinstance(uri, str):
79
+ uri = atom.http_core.Uri.parse_uri(uri)
80
+ if uri is not None:
81
+ uri.modify_request(http_request)
82
+ if isinstance(method, str):
83
+ http_request.method = method
84
+ # Any unrecognized arguments are assumed to be capable of modifying the
85
+ # HTTP request.
86
+ for name, value in kwargs.items():
87
+ if value is not None:
88
+ if hasattr(value, 'modify_request'):
89
+ value.modify_request(http_request)
90
+ else:
91
+ http_request.uri.query[name] = str(value)
92
+ # Default to an http request if the protocol scheme is not set.
93
+ if http_request.uri.scheme is None:
94
+ http_request.uri.scheme = 'http'
95
+ # Override scheme. Force requests over https.
96
+ if self.ssl:
97
+ http_request.uri.scheme = 'https'
98
+ if http_request.uri.path is None:
99
+ http_request.uri.path = '/'
100
+ # Add the Authorization header at the very end. The Authorization header
101
+ # value may need to be calculated using information in the request.
102
+ if auth_token:
103
+ auth_token.modify_request(http_request)
104
+ elif self.auth_token:
105
+ self.auth_token.modify_request(http_request)
106
+ # Check to make sure there is a host in the http_request.
107
+ if http_request.uri.host is None:
108
+ raise MissingHost('No host provided in request %s %s' % (
109
+ http_request.method, str(http_request.uri)))
110
+ # Perform the fully specified request using the http_client instance.
111
+ # Sends the request to the server and returns the server's response.
112
+ return self.http_client.request(http_request)
113
+
114
+ Request = request
115
+
116
+ def get(self, uri=None, auth_token=None, http_request=None, **kwargs):
117
+ """Performs a request using the GET method, returns an HTTP response."""
118
+ return self.request(method='GET', uri=uri, auth_token=auth_token,
119
+ http_request=http_request, **kwargs)
120
+
121
+ Get = get
122
+
123
+ def post(self, uri=None, data=None, auth_token=None, http_request=None,
124
+ **kwargs):
125
+ """Sends data using the POST method, returns an HTTP response."""
126
+ return self.request(method='POST', uri=uri, auth_token=auth_token,
127
+ http_request=http_request, data=data, **kwargs)
128
+
129
+ Post = post
130
+
131
+ def put(self, uri=None, data=None, auth_token=None, http_request=None,
132
+ **kwargs):
133
+ """Sends data using the PUT method, returns an HTTP response."""
134
+ return self.request(method='PUT', uri=uri, auth_token=auth_token,
135
+ http_request=http_request, data=data, **kwargs)
136
+
137
+ Put = put
138
+
139
+ def delete(self, uri=None, auth_token=None, http_request=None, **kwargs):
140
+ """Performs a request using the DELETE method, returns an HTTP response."""
141
+ return self.request(method='DELETE', uri=uri, auth_token=auth_token,
142
+ http_request=http_request, **kwargs)
143
+
144
+ Delete = delete
145
+
146
+ def modify_request(self, http_request):
147
+ """Changes the HTTP request before sending it to the server.
148
+
149
+ Sets the User-Agent HTTP header and fills in the HTTP host portion
150
+ of the URL if one was not included in the request (for this it uses
151
+ the self.host member if one is set). This method is called in
152
+ self.request.
153
+
154
+ Args:
155
+ http_request: An atom.http_core.HttpRequest() (optional) If one is
156
+ not provided, a new HttpRequest is instantiated.
157
+
158
+ Returns:
159
+ An atom.http_core.HttpRequest() with the User-Agent header set and
160
+ if this client has a value in its host member, the host in the request
161
+ URL is set.
162
+ """
163
+ if http_request is None:
164
+ http_request = atom.http_core.HttpRequest()
165
+
166
+ if self.host is not None and http_request.uri.host is None:
167
+ http_request.uri.host = self.host
168
+
169
+ if self.xoauth_requestor_id is not None:
170
+ http_request.uri.query['xoauth_requestor_id'] = self.xoauth_requestor_id
171
+
172
+ # Set the user agent header for logging purposes.
173
+ if self.source:
174
+ http_request.headers['User-Agent'] = '%s gdata-py/2.0.18' % self.source
175
+ else:
176
+ http_request.headers['User-Agent'] = 'gdata-py/2.0.17'
177
+
178
+ return http_request
179
+
180
+ ModifyRequest = modify_request
181
+
182
+
183
+ class CustomHeaders(object):
184
+ """Add custom headers to an http_request.
185
+
186
+ Usage:
187
+ >>> custom_headers = atom.client.CustomHeaders(header1='value1',
188
+ header2='value2')
189
+ >>> client.get(uri, custom_headers=custom_headers)
190
+ """
191
+
192
+ def __init__(self, **kwargs):
193
+ """Creates a CustomHeaders instance.
194
+
195
+ Initialize the headers dictionary with the arguments list.
196
+ """
197
+ self.headers = kwargs
198
+
199
+ def modify_request(self, http_request):
200
+ """Changes the HTTP request before sending it to the server.
201
+
202
+ Adds the custom headers to the HTTP request.
203
+
204
+ Args:
205
+ http_request: An atom.http_core.HttpRequest().
206
+
207
+ Returns:
208
+ An atom.http_core.HttpRequest() with the added custom headers.
209
+ """
210
+
211
+ for name, value in self.headers.items():
212
+ if value is not None:
213
+ http_request.headers[name] = value
214
+ return http_request