Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/google/cloud/bigquery/_http.py: 61%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

18 statements  

1# Copyright 2015 Google LLC 

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"""Create / interact with Google BigQuery connections.""" 

16 

17from google.cloud import _http # type: ignore # pytype: disable=import-error 

18from google.cloud.bigquery import __version__ 

19 

20 

21class Connection(_http.JSONConnection): 

22 """A connection to Google BigQuery via the JSON REST API. 

23 

24 Args: 

25 client (google.cloud.bigquery.client.Client): The client that owns the current connection. 

26 

27 client_info (Optional[google.api_core.client_info.ClientInfo]): Instance used to generate user agent. 

28 

29 api_endpoint (str): The api_endpoint to use. If None, the library will decide what endpoint to use. 

30 """ 

31 

32 DEFAULT_API_ENDPOINT = "https://bigquery.googleapis.com" 

33 DEFAULT_API_MTLS_ENDPOINT = "https://bigquery.mtls.googleapis.com" 

34 

35 def __init__(self, client, client_info=None, api_endpoint=None): 

36 super(Connection, self).__init__(client, client_info) 

37 self.API_BASE_URL = api_endpoint or self.DEFAULT_API_ENDPOINT 

38 self.API_BASE_MTLS_URL = self.DEFAULT_API_MTLS_ENDPOINT 

39 self.ALLOW_AUTO_SWITCH_TO_MTLS_URL = api_endpoint is None 

40 self._client_info.gapic_version = __version__ 

41 self._client_info.client_library_version = __version__ 

42 

43 API_VERSION = "v2" # type: ignore 

44 """The version of the API, used in building the API call's URL.""" 

45 

46 API_URL_TEMPLATE = "{api_base_url}/bigquery/{api_version}{path}" # type: ignore 

47 """A template for the URL of a particular API call."""