|
| 1 | +# Copyright 2016 Google Inc. All rights reserved. |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (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 |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | + |
| 16 | +"""Create / interact with gcloud Vision connections.""" |
| 17 | + |
| 18 | + |
| 19 | +from gcloud import connection as base_connection |
| 20 | + |
| 21 | + |
| 22 | +class Connection(base_connection.JSONConnection): |
| 23 | + """A connection to Google Cloud Vision via the JSON REST API. |
| 24 | +
|
| 25 | + :type credentials: :class:`oauth2client.client.OAuth2Credentials` |
| 26 | + :param credentials: (Optional) The OAuth2 Credentials to use for this |
| 27 | + connection. |
| 28 | +
|
| 29 | + :type http: :class:`httplib2.Http` or class that defines ``request()``. |
| 30 | + :param http: (Optional) HTTP object to make requests. |
| 31 | +
|
| 32 | + :type api_base_url: string |
| 33 | + :param api_base_url: The base of the API call URL. Defaults to the value |
| 34 | + :attr:`Connection.API_BASE_URL`. |
| 35 | + """ |
| 36 | + |
| 37 | + API_BASE_URL = 'https://vision.googleapis.com' |
| 38 | + """The base of the API call URL.""" |
| 39 | + |
| 40 | + API_VERSION = 'v1' |
| 41 | + """The version of the API, used in building the API call's URL.""" |
| 42 | + |
| 43 | + API_URL_TEMPLATE = '{api_base_url}/{api_version}{path}' |
| 44 | + """A template for the URL of a particular API call.""" |
| 45 | + |
| 46 | + SCOPE = ('https://www.googleapis.com/auth/cloud-platform',) |
| 47 | + """The scopes required for authenticating as a Cloud Vision consumer.""" |
0 commit comments