2020import hashlib
2121import json
2222
23- import six
23+ import http
24+ import urllib
2425
2526import google .auth .credentials
2627
@@ -110,15 +111,15 @@ def get_expiration_seconds_v2(expiration):
110111 micros = _helpers ._microseconds_from_datetime (expiration )
111112 expiration = micros // 10 ** 6
112113
113- if not isinstance (expiration , six . integer_types ):
114+ if not isinstance (expiration , int ):
114115 raise TypeError (
115116 "Expected an integer timestamp, datetime, or "
116117 "timedelta. Got %s" % type (expiration )
117118 )
118119 return expiration
119120
120121
121- _EXPIRATION_TYPES = six . integer_types + ( datetime .datetime , datetime .timedelta )
122+ _EXPIRATION_TYPES = ( int , datetime .datetime , datetime .timedelta )
122123
123124
124125def get_expiration_seconds_v4 (expiration ):
@@ -142,7 +143,7 @@ def get_expiration_seconds_v4(expiration):
142143
143144 now = NOW ().replace (tzinfo = _helpers .UTC )
144145
145- if isinstance (expiration , six . integer_types ):
146+ if isinstance (expiration , int ):
146147 seconds = expiration
147148
148149 if isinstance (expiration , datetime .datetime ):
@@ -250,7 +251,7 @@ def canonicalize_v2(method, resource, query_parameters, headers):
250251 (key .lower (), value and value .strip () or "" )
251252 for key , value in query_parameters .items ()
252253 )
253- encoded_qp = six . moves . urllib .parse .urlencode (normalized_qp )
254+ encoded_qp = urllib .parse .urlencode (normalized_qp )
254255 canonical_resource = "{}?{}" .format (resource , encoded_qp )
255256 return _Canonical (method , canonical_resource , normalized_qp , headers )
256257
@@ -410,7 +411,7 @@ def generate_signed_url_v2(
410411 return "{endpoint}{resource}?{querystring}" .format (
411412 endpoint = api_access_endpoint ,
412413 resource = resource ,
413- querystring = six . moves . urllib .parse .urlencode (sorted_signed_query_params ),
414+ querystring = urllib .parse .urlencode (sorted_signed_query_params ),
414415 )
415416
416417
@@ -563,7 +564,7 @@ def generate_signed_url_v4(
563564
564565 header_names = [key .lower () for key in headers ]
565566 if "host" not in header_names :
566- headers ["Host" ] = six . moves . urllib .parse .urlparse (api_access_endpoint ).netloc
567+ headers ["Host" ] = urllib .parse .urlparse (api_access_endpoint ).netloc
567568
568569 if method .upper () == "RESUMABLE" :
569570 method = "POST"
@@ -686,7 +687,7 @@ def _sign_message(message, access_token, service_account_email):
686687 request = requests .Request ()
687688 response = request (url = url , method = method , body = body , headers = headers )
688689
689- if response .status != six . moves . http_client .OK :
690+ if response .status != http . client .OK :
690691 raise exceptions .TransportError (
691692 "Error calling the IAM signBytes API: {}" .format (response .data )
692693 )
@@ -723,4 +724,4 @@ def _quote_param(param):
723724 """
724725 if not isinstance (param , bytes ):
725726 param = str (param )
726- return six . moves . urllib .parse .quote (param , safe = "~" )
727+ return urllib .parse .quote (param , safe = "~" )
0 commit comments