| Trees | Indices | Help |
|---|
|
|
Client for discovery based APIs A client library for Google's discovery based APIs.
Author: jcgregorio@google.com (Joe Gregorio)
|
|||
|
Resource A class for interacting with a resource. |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
| copy | |||
| httplib2 | |||
| logging | |||
| os | |||
| re | |||
| uritemplate | |||
| urllib | |||
| urlparse | |||
| mimeparse | |||
| mimetypes | |||
| parse_qsl | |||
| HttpError | |||
| InvalidJsonError | |||
| MediaUploadSizeError | |||
| UnacceptableMimeTypeError | |||
| UnknownApiNameOrVersion | |||
| UnknownFileType | |||
| HttpRequest | |||
| MediaFileUpload | |||
| MediaUpload | |||
| JsonModel | |||
| MediaModel | |||
| RawModel | |||
| Schemas | |||
| MIMEMultipart | |||
| MIMENonMultipart | |||
| positional | |||
| simplejson | |||
logger = logging.getLogger(__name__)
|
|||
URITEMPLATE = re.compile('{[^}]*}')
|
|||
VARNAME = re.compile('[a-zA-Z0-9_-]+')
|
|||
DISCOVERY_URI = 'https://www.googleapis.com/discovery/v1/apis/
|
|||
DEFAULT_METHOD_DOC = 'A description of how to use this function'
|
|||
STACK_QUERY_PARAMETERS = ['trace', 'pp', 'userip', 'strict']
|
|||
RESERVED_WORDS = ['and', 'assert', 'break', 'class', 'continue
|
|||
MULTIPLIERS = {"KB": 2** 10, "MB": 2** 20, "GB": 2** 30, "TB":
|
|||
|
|||
Fix method names to avoid reserved word conflicts. Args: name: string, method name. Returns: The name with a '_' prefixed if the name is a reserved word. |
Adds a query parameter to a url. Replaces the current value if it already exists in the URL. Args: url: string, url to add the query parameter to. name: string, query parameter name. value: string, query parameter value. Returns: Updated query parameter. Does not update the url if value is None. |
Converts key names into parameter names. For example, converting "max-results" -> "max_results" Args: key: string, the method key name. Returns: A safe method name based on the key name. |
Construct a Resource for interacting with an API.
Construct a Resource object for interacting with an API. The serviceName and
version are the names from the Discovery service.
Args:
serviceName: string, name of the service.
version: string, the version of the service.
http: httplib2.Http, An instance of httplib2.Http or something that acts
like it that HTTP requests will be made through.
discoveryServiceUrl: string, a URI Template that points to the location of
the discovery service. It should have two parameters {api} and
{apiVersion} that when filled in produce an absolute URI to the discovery
document for that service.
developerKey: string, key obtained from
https://code.google.com/apis/console.
model: apiclient.Model, converts to and from the wire format.
requestBuilder: apiclient.http.HttpRequest, encapsulator for an HTTP
request.
Returns:
A Resource object with methods for interacting with the service.
|
Create a Resource for interacting with an API.
Same as `build()`, but constructs the Resource object from a discovery
document that is it given, as opposed to retrieving one over HTTP.
Args:
service: string or object, the JSON discovery document describing the API.
The value passed in may either be the JSON string or the deserialized
JSON.
base: string, base URI for all HTTP requests, usually the discovery URI.
This parameter is no longer used as rootUrl and servicePath are included
within the discovery document. (deprecated)
future: string, discovery document with future capabilities (deprecated).
http: httplib2.Http, An instance of httplib2.Http or something that acts
like it that HTTP requests will be made through.
developerKey: string, Key for controlling API usage, generated
from the API Console.
model: Model class instance that serializes and de-serializes requests and
responses.
requestBuilder: Takes an http request and packages it up to be executed.
Returns:
A Resource object with methods for interacting with the service.
|
Convert value to a string based on JSON Schema type. See http://tools.ietf.org/html/draft-zyp-json-schema-03 for more details on JSON Schema. Args: value: any, the value to convert schema_type: string, the type that value should be interpreted as Returns: A string representation of 'value' based on the schema_type. |
Convert a string media size, such as 10GB or 3TB into an integer. Args: maxSize: string, size as a string, such as 2MB or 7GB. Returns: The size as an integer value. |
Creates a method for attaching to a Resource.
Args:
methodName: string, name of the method to use.
methodDesc: object, fragment of deserialized discovery document that
describes the method.
rootDesc: object, the entire deserialized discovery document.
schema: object, mapping of schema names to schema descriptions.
|
Creates any _next methods for attaching to a Resource. The _next methods allow for easy iteration through list() responses. Args: methodName: string, name of the method to use. |
|
|||
DISCOVERY_URI
|
RESERVED_WORDS
|
MULTIPLIERS
|
| Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0.1 on Thu Jan 24 16:14:31 2013 | http://epydoc.sourceforge.net |