OLD | NEW |
1 # Copyright 2014 Google Inc. All Rights Reserved. | 1 # Copyright 2014 Google Inc. All Rights Reserved. |
2 # | 2 # |
3 # Licensed under the Apache License, Version 2.0 (the "License"); | 3 # Licensed under the Apache License, Version 2.0 (the "License"); |
4 # you may not use this file except in compliance with the License. | 4 # you may not use this file except in compliance with the License. |
5 # You may obtain a copy of the License at | 5 # You may obtain a copy of the License at |
6 # | 6 # |
7 # http://www.apache.org/licenses/LICENSE-2.0 | 7 # http://www.apache.org/licenses/LICENSE-2.0 |
8 # | 8 # |
9 # Unless required by applicable law or agreed to in writing, software | 9 # Unless required by applicable law or agreed to in writing, software |
10 # distributed under the License is distributed on an "AS IS" BASIS, | 10 # distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 29 matching lines...) Expand all Loading... |
40 import re | 40 import re |
41 import urllib | 41 import urllib |
42 import urlparse | 42 import urlparse |
43 | 43 |
44 try: | 44 try: |
45 from urlparse import parse_qsl | 45 from urlparse import parse_qsl |
46 except ImportError: | 46 except ImportError: |
47 from cgi import parse_qsl | 47 from cgi import parse_qsl |
48 | 48 |
49 # Third-party imports | 49 # Third-party imports |
50 from ... import httplib2 | 50 from third_party import httplib2 |
| 51 from third_party.uritemplate import uritemplate |
51 import mimeparse | 52 import mimeparse |
52 from ... import uritemplate | |
53 | 53 |
54 # Local imports | 54 # Local imports |
55 from googleapiclient.errors import HttpError | 55 from googleapiclient.errors import HttpError |
56 from googleapiclient.errors import InvalidJsonError | 56 from googleapiclient.errors import InvalidJsonError |
57 from googleapiclient.errors import MediaUploadSizeError | 57 from googleapiclient.errors import MediaUploadSizeError |
58 from googleapiclient.errors import UnacceptableMimeTypeError | 58 from googleapiclient.errors import UnacceptableMimeTypeError |
59 from googleapiclient.errors import UnknownApiNameOrVersion | 59 from googleapiclient.errors import UnknownApiNameOrVersion |
60 from googleapiclient.errors import UnknownFileType | 60 from googleapiclient.errors import UnknownFileType |
61 from googleapiclient.http import HttpRequest | 61 from googleapiclient.http import HttpRequest |
62 from googleapiclient.http import MediaFileUpload | 62 from googleapiclient.http import MediaFileUpload |
63 from googleapiclient.http import MediaUpload | 63 from googleapiclient.http import MediaUpload |
64 from googleapiclient.model import JsonModel | 64 from googleapiclient.model import JsonModel |
65 from googleapiclient.model import MediaModel | 65 from googleapiclient.model import MediaModel |
66 from googleapiclient.model import RawModel | 66 from googleapiclient.model import RawModel |
67 from googleapiclient.schema import Schemas | 67 from googleapiclient.schema import Schemas |
68 from oauth2client.client import GoogleCredentials | 68 from third_party.oauth2client.client import GoogleCredentials |
69 from oauth2client.util import _add_query_parameter | 69 from third_party.oauth2client.util import _add_query_parameter |
70 from oauth2client.util import positional | 70 from third_party.oauth2client.util import positional |
71 | 71 |
72 | 72 |
73 # The client library requires a version of httplib2 that supports RETRIES. | 73 # The client library requires a version of httplib2 that supports RETRIES. |
74 httplib2.RETRIES = 1 | 74 httplib2.RETRIES = 1 |
75 | 75 |
76 logger = logging.getLogger(__name__) | 76 logger = logging.getLogger(__name__) |
77 | 77 |
78 URITEMPLATE = re.compile('{[^}]*}') | 78 URITEMPLATE = re.compile('{[^}]*}') |
79 VARNAME = re.compile('[a-zA-Z0-9_-]+') | 79 VARNAME = re.compile('[a-zA-Z0-9_-]+') |
80 DISCOVERY_URI = ('https://www.googleapis.com/discovery/v1/apis/' | 80 DISCOVERY_URI = ('https://www.googleapis.com/discovery/v1/apis/' |
(...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 responseSchema = methodDesc['response'] | 986 responseSchema = methodDesc['response'] |
987 if '$ref' in responseSchema: | 987 if '$ref' in responseSchema: |
988 responseSchema = schema.get(responseSchema['$ref']) | 988 responseSchema = schema.get(responseSchema['$ref']) |
989 hasNextPageToken = 'nextPageToken' in responseSchema.get('properties', | 989 hasNextPageToken = 'nextPageToken' in responseSchema.get('properties', |
990 {}) | 990 {}) |
991 hasPageToken = 'pageToken' in methodDesc.get('parameters', {}) | 991 hasPageToken = 'pageToken' in methodDesc.get('parameters', {}) |
992 if hasNextPageToken and hasPageToken: | 992 if hasNextPageToken and hasPageToken: |
993 fixedMethodName, method = createNextMethod(methodName + '_next') | 993 fixedMethodName, method = createNextMethod(methodName + '_next') |
994 self._set_dynamic_attr(fixedMethodName, | 994 self._set_dynamic_attr(fixedMethodName, |
995 method.__get__(self, self.__class__)) | 995 method.__get__(self, self.__class__)) |
OLD | NEW |