
    t                        S r SSKrSSKrSSKrSSKrSSKrSSKrSSKJr  SSKJ	r	  SSK
Jr  SSK
Jr  SSKJr  SSKJr  SS	KJr  SS
KJr  / SQr\R&                  " S5      R)                  \R*                  5        Sr " S S\R.                  5      r " S S\R.                  5      rSrS rS rS rS r " S S\5      r S r! " S S\5      r" " S S\5      r#g)zBase class for api services.    N)http_client)urllib)message_types)messages)encoding)
exceptions)http_wrapper)util)ApiMethodInfoApiUploadInfoBaseApiClientBaseApiServiceNormalizeApiEndpointzoauth2client.utili   c                       \ rS rSrSr\R                  " SSS9r\R                  " S5      r	\R                  " S5      r
\R                  " S5      r\R                  " S	5      r\R                  " S
5      rSrg)r   5   a$  Media upload information for a method.

Fields:
  accept: (repeated) MIME Media Ranges for acceptable media uploads
      to this method.
  max_size: (integer) Maximum size of a media upload, such as 3MB
      or 1TB (converted to an integer).
  resumable_path: Path to use for resumable uploads.
  resumable_multipart: (boolean) Whether or not the resumable endpoint
      supports multipart uploads.
  simple_path: Path to use for simple uploads.
  simple_multipart: (boolean) Whether or not the simple endpoint
      supports multipart uploads.
   Trepeated                N)__name__
__module____qualname____firstlineno____doc__r   StringFieldacceptIntegerFieldmax_sizeresumable_pathBooleanFieldresumable_multipartsimple_pathsimple_multipart__static_attributes__r       ,lib/third_party/apitools/base/py/base_api.pyr   r   5   sm     !!!d3F$$Q'H))!,N"//2&&q)K,,Q/r*   r   c                      \ rS rSrSr\R                  " S5      r\R                  " S5      r\R                  " S5      r	\R                  " S5      r
\R                  " SSS	9r\R                  " S
SS	9r\R                  " SSS	9r\R                  " S5      r\R                  " S5      r\R                  " S5      r\R                  " SSS9r\R$                  " \S5      r\R*                  " SSS9r\R                  " S5      rSrg)r   M   a\  Configuration info for an API method.

All fields are strings unless noted otherwise.

Fields:
  relative_path: Relative path for this method.
  flat_path: Expanded version (if any) of relative_path.
  method_id: ID for this method.
  http_method: HTTP verb to use for this method.
  path_params: (repeated) path parameters for this method.
  query_params: (repeated) query parameters for this method.
  ordered_params: (repeated) ordered list of parameters for
      this method.
  description: description of this method.
  request_type_name: name of the request type.
  response_type_name: name of the response type.
  request_field: if not null, the field to pass as the body
      of this POST request. may also be the REQUEST_IS_BODY
      value below to indicate the whole message is the body.
  upload_config: (ApiUploadInfo) Information about the upload
      configuration supported by this method.
  supports_download: (boolean) If True, this method supports
      downloading the request via the `alt=media` query
      parameter.
  api_version_param: API version system parameter for this
      method.
r   r   r   r   r   Tr   r         	   
       )default      F   r   N)r   r   r   r   r   r   r    relative_path	flat_path	method_idhttp_methodpath_paramsquery_paramsordered_paramsdescriptionrequest_type_nameresponse_type_namerequest_fieldMessageFieldr   upload_configr%   supports_downloadapi_version_paramr)   r   r*   r+   r   r   M   s    8 ((+M$$Q'I$$Q'I&&q)K&&q48K''D9L))!d;N&&q)K ,,Q/!--b1((R8M))-<M --b%@ ,,R0r*   r   z	<request>c                     U R                  S5      (       a$  U R                  S5      u    p#[        [        U5      $ SU ;  a  [        X5      $ [        R
                  " SU -  5      e)Nzmessage_types..zUnknown class %s)
startswith	partitiongetattrr   r   GeneratedClientError)namemessages_module_	classnames       r+   
_LoadClassrQ   ~   sZ    '((..-1}i00	D----.@4.GHHr*   c                     U Hk  nUR                  5       n[        U SU-  5      (       a  [        X5      (       a  M9  SU< S[        U 5      R                  < S3n[
        R                  " U5      e   g )Nz%szNo z specified for object of class rH   )upperhasattrrK   typer   r   rL   )objattrsattr	attr_namemsgs        r+   _RequireClassAttrsr[      s[    JJL	sD9,--WS5L5L49--/C11#66 r*   c                 <    U R                  S5      (       d  U S-  n U $ )N/)endswith)api_endpoints    r+   r   r      s#      %%r*   c                    UR                  S5      (       d  UR                  S5      (       a  [        R                  R                  X5      $ U R	                  S5      (       a  U OU S-   nUR                  S5      (       a  USS OUnX#-   $ )z8Custom urljoin replacement supporting : before / in url.zhttp://zhttps://r]   r   N)rI   r   parseurljoinr^   )baseurlnew_basenew_urls       r+   _urljoinrg      ss     ~~i  CNN:$>$>||##D..}}S))ttczH,,c!"g#Gr*   c                       \ rS rSrSrSS jr\S 5       r\S 5       r	\	R                  S 5       r	\S 5       r\S	 5       rS
rg)_UrlBuilder   z"Convenient container for url data.Nc                    [         R                  R                  [        X=(       d    S5      5      nUR                  (       a#  [
        R                  " SUR                  -  5      e[         R                  R                  UR                  =(       d    S5      U l	        Ub  U R                  R                  U5        UR                  U l        UR                  U l        UR                  =(       d    SU l        g )Nr3   zUnexpected url fragment: %s)r   ra   urlsplitrg   fragmentr   ConfigurationValueErrorparse_qsqueryr=   updatescheme_UrlBuilder__schemenetloc_UrlBuilder__netlocpathr8   )selfbase_urlr8   r=   
componentss        r+   __init___UrlBuilder.__init__   s    \\**8)r,+ ,
44-
0C0CCE E"LL11*2B2B2HbI#$$\2"))"))'__2r*   c                 :   [         R                  R                  U5      n[         R                  R                  UR                  5      n[         R                  R                  UR                  UR                  SS S 45      nUR                  =(       d    SnU " XEUS9$ )Nr3   )r8   r=   )	r   ra   rl   ro   rp   
urlunsplitrr   rt   rv   )clsrd   urlpartsr=   rx   r8   s         r+   FromUrl_UrlBuilder.FromUrl   s|    <<((-||,,X^^<<<**OOX__b$,> ? +N 	Nr*   c                 r    [         R                  R                  U R                  U R                  SSS45      $ )Nr3   )r   ra   r}   rs   ru   rw   s    r+   rx   _UrlBuilder.base_url   s/    ||&&]]DMM2r268 	8r*   c                    [         R                  R                  U5      nUR                  (       d"  UR                  (       d  UR
                  (       a  [        R                  " SU-  5      eUR                  U l	        UR                  U l        g )NzInvalid base url: %s)r   ra   rl   rv   rp   rm   r   rn   rr   rs   rt   ru   )rw   valuery   s      r+   rx   r      sb    \\**51
??j..*2E2E44&.0 0"))"))r*   c                 V    [         R                  R                  U R                  S5      $ )NT)r   ra   	urlencoder=   r   s    r+   rp   _UrlBuilder.query   s!     ||%%d&7&7>>r*   c                     SU R                   ;   d  SU R                   ;   a#  [        R                  " SU R                   -  5      e[        R                  R                  U R                  U R                  U R                   U R                  S45      $ )N{}z'Cannot create url with relative path %sr3   )	r8   r   rn   r   ra   r}   rs   ru   rp   r   s    r+   rd   _UrlBuilder.url   s|    $$$$t/A/A(A449D<N<NNP P||&&MM4==$*<*<djj"(N O 	Or*   )__netloc__schemer=   r8   )NN)r   r   r   r   r   rz   classmethodr   propertyrx   setterrp   rd   r)   r   r*   r+   ri   ri      sv    ,3 N N 8 8 __* * ? ? O Or*   ri   c                      g)z0Hook for skipping credentials. For internal use.Fr   r   r*   r+   _SkipGetCredentialsr      s    r*   c                      \ rS rSrSrSrSrSrSrSr	/ r
Sr      S S jrS r\S 5       r\S 5       r\S	 5       r\S
 5       r\S 5       r\S 5       r\S 5       r\S 5       rS r\S 5       r\R6                  S 5       r\S 5       r\R6                  S 5       r\S 5       r\R@                  S 5       r\S 5       r!\!R@                  S 5       r!\R6                  S 5       r"S r#S r$S r%S r&S r'S r(Sr)g)!r      z Base class for client libraries.Nr3   c                    [        U S5        Ub   [        R                  " XR                  5        Xl        X`l        Xpl        SU l        SU l        Xl	        Xl
        X l        U=(       a    [        5       (       + nU(       a$  U(       d  U
=(       d    0 n
U R                  " S0 U
D6  [        U5      U l        U=(       d    [         R"                  " 5       U l        U R                  b*  U R                  R'                  U R$                  5      U l        S U l        U=(       d    0 U l        Xl        Xl        Xl        SU l        UnSU l        g )N)_package_scopesrN   r   <   Fprotor   )r[   r
   	Typecheckparams_type%_BaseApiClient__default_global_paramslog_requestlog_response_BaseApiClient__num_retries_BaseApiClient__max_retry_waitnum_retriesmax_retry_wait_credentialsr   _SetCredentialsr   _urlr	   GetHttp_http	authorize_BaseApiClient__include_fieldsadditional_http_headerscheck_response_func
retry_funcresponse_encoding(overwrite_transfer_urls_with_client_base#_BaseApiClient__response_type_model)rw   rd   credentialsget_credentialshttpmodelr   r   r   r   credentials_argsdefault_global_paramsr   r   r   r   rO   s                    r+   rz   BaseApiClient.__init__   s    	4!KL ,NN02B2BC'<$&( "&,')G2E2G.G;/52  4#34(-	3\113
(**44TZZ@DJ $'>'D"$#6 $!2 9>5 %,"r*   c                     U R                   U U R                  U R                  U R                  U R                  U R
                  S.nUR                  U5        SSKJn  UR                  " S0 UD6U l
        g)a  Fetch credentials, and set them for this client.

Note that we can't simply return credentials, since creating them
may involve side-effecting self.

Args:
  **kwds: Additional keyword arguments are passed on to GetCredentials.

Returns:
  None. Sets self._credentials.
)api_keyclient	client_idclient_secretpackage_namescopes
user_agentr   )credentials_libNr   )_API_KEY
_CLIENT_ID_CLIENT_SECRET_PACKAGE_SCOPES_USER_AGENTrq   apitools.base.pyr   GetCredentialsr   )rw   kwdsargsr   s       r+   r   BaseApiClient._SetCredentials  se     }}!00 MMll**
 	D4 ,::BTBr*   c           	          U R                   U R                  SR                  [        [        R
                  " U R                  5      5      5      U R                  S.$ )N )r   r   scoper   )r   r   joinsortedr
   NormalizeScopesr   r   r~   s    r+   
ClientInfoBaseApiClient.ClientInfo=  sE      //XXfT%9%9#++%FGH//	
 	
r*   c                     g Nr   r   s    r+   base_model_classBaseApiClient.base_model_classF  s    r*   c                     U R                   $ r   )r   r   s    r+   r   BaseApiClient.httpJ  s    zzr*   c                     U R                   $ r   )r   r   s    r+   rd   BaseApiClient.urlN  s    yyr*   c                     U R                   $ r   )r   r   s    r+   	GetScopesBaseApiClient.GetScopesR  s    {{r*   c                 .    [        SU R                  5      $ )NStandardQueryParameters)rQ   MESSAGES_MODULEr   s    r+   r   BaseApiClient.params_typeV  s    3T5I5IJJr*   c                     U R                   $ r   )r   r   s    r+   r   BaseApiClient.user_agentZ  s    r*   c                 ^    U R                   c  U R                  5       U l         U R                   $ r   )r   r   r   s    r+   _default_global_params$BaseApiClient._default_global_params^  s+    ''/+/+;+;+=D(+++r*   c                 4    U R                   n[        X1U5        g r   )r   setattr)rw   rM   r   paramss       r+   AddGlobalParamBaseApiClient.AddGlobalParame  s    ,,e$r*   c                 B    [         R                  " U R                  5      $ r   )r   CopyProtoMessager   r   s    r+   global_paramsBaseApiClient.global_paramsi  s    (()D)DEEr*   c              #   .   #    Xl         S v   S U l         g 7fr   )r   )rw   include_fieldss     r+   IncludeFieldsBaseApiClient.IncludeFieldsm  s      . $s   c                     U R                   $ r   )r   r   s    r+   response_type_model!BaseApiClient.response_type_models  s    )))r*   c              #   F   #    U R                   nSU l        Sv   Xl        g7f)z2In this context, return raw JSON instead of proto.jsonN)r   r   )rw   	old_models     r+   JsonResponseModelBaseApiClient.JsonResponseModelw  s#      ,,	%+"%."s   !c                     U R                   $ r   )r   r   s    r+   r   BaseApiClient.num_retries  s    !!!r*   c                     [         R                  " U[        R                  5        US:  a  [        R
                  " S5      eXl        g )Nr   z*Cannot have negative value for num_retries)r
   r   sixinteger_typesr   InvalidDataErrorr   rw   r   s     r+   r   r     s9    uc//019--<> >"r*   c                     U R                   $ r   )r   r   s    r+   r   BaseApiClient.max_retry_wait  s    $$$r*   c                     [         R                  " U[        R                  5        US::  a  [        R
                  " S5      eXl        g )Nr   z)max_retry_wait must be a postiive integer)r
   r   r  r  r   r  r   r  s     r+   r   r    s9    uc//0A:--;= = %r*   c              #   D   #    U R                   nXl         S v   X l         g 7fr   )r   )rw   r   old_num_retriess      r+   WithRetriesBaseApiClient.WithRetries  s     **&*s    c                     U R                   (       a-  [        R                  " SUR                  UR                  U5        U$ )z$Hook for pre-processing of requests.zCalling method %s with %s: %s)r   logginginfor:   r@   )rw   method_configrequests      r+   ProcessRequestBaseApiClient.ProcessRequest  s4    LL/1H1H//: r*   c                    UR                   R                  U R                  5        U R                  (       a  [        R
                  " SUR                  UR                  5        [        R
                  " S[        R                  " UR                   5      5        UR                  (       a6  [        R
                  " SUR                  =(       d    UR                  5        U$ [        R
                  " S5        U$ )z)Hook for pre-processing of http requests.zMaking http %s to %szHeaders: %szBody:
%szBody: (none))headersrq   r   r   r  r  r;   rd   pprintpformatbodyloggable_body)rw   http_requests     r+   ProcessHttpRequest BaseApiClient.ProcessHttpRequest  s    ##D$@$@ALL/%11<3C3CELL|7K7K(LM   [)77L<;L;LN  ^,r*   c                 l    U R                   (       a"  [        R                  " SUR                  U5        U$ )NzResponse of type %s: %s)r   r  r  rA   )rw   r  responses      r+   ProcessResponseBaseApiClient.ProcessResponse  s+    LL2&998Er*   c                 >    [         R                  " XR                  S9$ )N)r   )r   MessageToJsonr   )rw   messages     r+   SerializeMessageBaseApiClient.SerializeMessage  s    %%$9$9; 	;r*   c           	           [         R                  " X5      nU$ ! [        R                  [        R
                  [        4 a1  n[        R                  " SU< SUR                  < SU< 35      eSnAff = f)z:Deserialize the given data as method_config.response_type.zError decoding response "z
" as type z: N)r   JsonToMessager   InvalidDataFromServerErrorr   ValidationError
ValueErrorr   )rw   response_typedatar#  es        r+   DeserializeMessage BaseApiClient.DeserializeMessage  sk    	6,,]AG  55((*6 	677-00!56 6	6s    )A4,A//A4c                 D   [         R                  U5      n[        U R                  SS5      (       a#  U R                  R                  UR
                  S'   U R                  (       a0  [         R                  U R                  5      nUR                  Ul        UR                  $ )z?Modify the url for a given transfer, based on auth and version.keyN)
ri   r   rK   r   r1  r=   r   r   rx   rd   )rw   rd   url_builderclient_url_builders       r+   FinalizeTransferUrl!BaseApiClient.FinalizeTransferUrl  sy    !))#.4%%ud33.2.@.@.D.DK$$U+88!,!4!4TYY!?#5#>#>K r*   )__default_global_params__include_fields__max_retry_wait__num_retries__response_type_modelr   r   r   r   r   r   r   r   r   r   r   r   )NTNNFFr   r   NNNNNN)*r   r   r   r   r   r   r   r   r   r   r   r   rz   r   r   r   r   r   r   rd   r   r   r   r   r   r   
contextlibcontextmanagerr   r   r   r   r   r   r  r  r  r  r$  r.  r4  r)   r   r*   r+   r   r      s   *OHJNHGKIM=BDHEI6:#')-VC> 
 
         K K     , ,% F F % %
 * * / / " " # # % % & & + + ;	r*   r   c                       \ rS rSrSrS r\S 5       r\S 5       rS r	\
S 5       rS rS	 rS
 rS rS rS rS r SS jrS rS rS rS rS r  SS jr  SS jrSS jrSrg)r   i  z&Base class for generated API services.c                 ,    Xl         0 U l        0 U l        g r   )_BaseApiService__client_method_configs_upload_configs)rw   r   s     r+   rz   BaseApiService.__init__  s    !!r*   c                     U R                   $ r   r?  r   s    r+   _clientBaseApiService._client      }}r*   c                     U R                   $ r   rD  r   s    r+   r   BaseApiService.client  rG  r*   c                     U R                   R                  U5      nU(       a  U$ [        XS5      nUc  [        U5      e[        USS5      nUc  [        U5      eU" 5       =U R                   U'   nU$ )z6Returns service cached method config for given method.Nr  )r@  getrK   KeyError)rw   methodr  funcconfigs        r+   GetMethodConfigBaseApiService.GetMethodConfig  sx    ,,008  tT*<6""ot< 6""0=?V$vr*   c                     [         R                  " U R                  5       Vs/ s H#  n[        USS 5      (       d  M  UR                  PM%     sn$ s  snf )Nr  )r  
itervalues__dict__rK   r   )r~   fs     r+   GetMethodsListBaseApiService.GetMethodsList  sF    $'NN3<<$@ 6$@q1ot4 

$@ 6 	6 6s
   AAc                 8    U R                   R                  U5      $ r   )rA  rK  )rw   rM  s     r+   GetUploadConfigBaseApiService.GetUploadConfig  s    ##''//r*   c                 x    U R                  U5      n[        U R                  R                  UR                  5      $ r   )rP  rK   r   r   r@   rw   rM  r  s      r+   GetRequestTypeBaseApiService.GetRequestType  s4    ,,V4t{{22$668 	8r*   c                 x    U R                  U5      n[        U R                  R                  UR                  5      $ r   )rP  rK   r   r   rA   r\  s      r+   GetResponseTypeBaseApiService.GetResponseType  s4    ,,V4t{{22$779 	9r*   c                    [         R                  " U[        S5      U R                  R                  45        U R                  R	                  5       nU=(       d    U R                  R	                  5       nUR                  5        H]  nUR                  UR                  5      nUc  UR                  UR                  5      nUS/ S4;  d  MG  [        X4R                  U5        M_     U$ )z+Combine the given params with the defaults.Nr   )	r
   r   rU   r?  r   
all_fieldsget_assigned_valuerM   r   )rw   r   default_paramsresultfieldr   s         r+   __CombineGlobalParams$BaseApiService.__CombineGlobalParams  s    }tDz4==3L3L&MN**,%D)B)B)D&&(E!44UZZ@E}&99%**ET2rN*

E2 ) r*   c                 v    UR                  SS5      (       d  SUS'   UR                  SS5      (       d  SUS'   U$ )NprettyPrintTr   pp)pop)rw   
query_infos     r+   __EncodePrettyPrint"BaseApiService.__EncodePrettyPrint  sB     ~~mT22()J}% ~~dD)) Jtr*   c                    [        U[        R                  5      (       a  Ub  [        R                  " U5      $ [        U[
        R                  5      (       a  UR                  S5      $ [        U[
        R                  5      (       a  UR                  S5      $ [        U[        R                  5      (       a  UR                  5       $ U$ )zAEncode value for the URL, using field to skip encoding for bytes.utf8)
isinstancer   
BytesFieldbase64urlsafe_b64encoder  	text_typeencodebinary_typedecodedatetime	isoformat)rw   r   rg  s      r+   __FinalUrlValueBaseApiService.__FinalUrlValue   s    eX0011e6G++E22s}}--<<''s//<<''x0011??$$r*   c                   ^ ^^^^	 T R                  TT R                  R                  5      m[        R                  " T R                  R
                  R                  5        Vs/ s H  oDR                  PM     snT R                  R
                  5      n[        T5      m[        UUU 4S jU 5       5      n[        R                  " U[        T5      5      n[        T5      m	UR                  UU	U 4S jU 5       5        [        S UR                  5        5       5      nT R                  U5      n[        R                  " U[        T5      5      nU$ s  snf )z<Construct a dictionary of query parameters for this request.c           	   3   t   >#    U  H-  nUTR                  [        TU5      [        TU5      5      4v   M/     g 7fr   _BaseApiService__FinalUrlValuerK   ).0paramr   global_params_typerw   s     r+   	<genexpr>8BaseApiService.__ConstructQueryParams.<locals>.<genexpr>5  sE      - , !!'-"?")*<e"DFG ,s   58c           	   3   v   >#    U  H.  nUTR                  [        TUS 5      [        TU5      5      4v   M0     g 7fr   r  )r  r  r  request_typerw   s     r+   r  r  =  sF      , + !!''5$"?"),">@A +s   69c              3   6   #    U  H  u  pUc  M
  X4v   M     g 7fr   r   )r  kvs      r+   r  r  B  s       ,-?TQ !1&-?s   	
)$_BaseApiService__CombineGlobalParamsr?  r   r
   MapParamNamesr   rc  rM   rU   dictrq   items"_BaseApiService__EncodePrettyPrintMapRequestParams)
rw   r=   r  r   xglobal_param_namesrn  query_param_namesr  r  s
   ` ``    @@r+   __ConstructQueryParams%BaseApiService.__ConstructQueryParams,  s#    224==668!//!]]66AACDCVVCDMM%%' "-0 - ,	- -
 !..|T']KG} , +	, 	,
  ,Z-=-=-? , ,
--j9
**:tG}E
) Es   "ENc                    [         R                  " UR                  [        U5      5      n[	        U Vs/ s H  nU[        X%S5      4PM     sn5      n[         R                  " U[        U5      5      n[         R                  " XUS9$ s  snf )z(Determine the relative path for request.Nr8   )r
   r  r<   rU   r  rK   r  ExpandRelativePath)rw   r  r  r8   python_param_namesr  r   s          r+   __ConstructRelativePath&BaseApiService.__ConstructRelativePathH  s     "//%%tG}6$68$65 wwt<=$68 9&&vtG}=&&}5BD 	D8s   Bc                     UR                   S:X  aZ  [        UR                  5      [        :  a=  SUl         SUR                  S'   SUR                  S'   UR
                  Ul        0 Ul        UR                  Ul        g)z2Make any final general adjustments to the request.GETPOSTzx-http-method-overridez!application/x-www-form-urlencodedcontent-typeN)r;   lenrd   _MAX_URL_LENGTHr  rp   r  r=   )rw   r  r2  s      r+   __FinalizeRequest BaseApiService.__FinalizeRequestS  st    $$-L$$%7'-L$=BL  !9:"E     + 1 1L')K$&??r*   c                    UR                   [        R                  [        R                  [        R                  4;  a  [
        R                  R                  X!US9eUR                   [        R                  :X  a*  [        R                  " UR                  SUR                  S9nUR                  nU R                  R                  (       a:  [        U[         5      (       a%  UR#                  U R                  R                  5      nU R$                  R&                  S:X  a  U$ [)        UR*                  U R$                  R,                  5      nU R$                  R/                  XT5      $ )z Process the given http response.)r  r  z{})r  contentrequest_urlr   )status_coder   OKCREATED
NO_CONTENTr   	HttpErrorFromResponser	   Responser  r  r  rE  r   rs  bytesrz  r?  r   rQ   rA   r   r.  )rw   r  http_responser  r  r+  s         r+   __ProcessHttpResponse$BaseApiService.__ProcessHttpResponse_  s   $$[^^-8-@-@-8-C-C-E E &&33G 4 M M$$(>(>> )11"'')557M  ''<<))j%.H.HnnT\\%C%CDG==,,6N"=#C#C#'==#@#@B}}//GGr*   c                     UR                   =(       d    SnX1R                  S'   SUR                  S'   SUR                  S'   g)z*Fill in the basic headers on http_request.zapitools-client/1.0z
user-agentapplication/jsonr!   zgzip, deflatezaccept-encodingN)r   r  )rw   r  r   r   s       r+   __SetBaseHeadersBaseApiService.__SetBaseHeadersw  sD     &&?*?
-7\*);X&2A./r*   c                 Z    UR                   (       a  UR                   UR                  S'   gg)z;Fill in the system parameters to always set for the method.zX-Goog-Api-VersionN)rF   r  )rw   r  r  s      r+   __SetBaseSystemParams$BaseApiService.__SetBaseSystemParams  s*    		(	(-- 

3
4 
)r*   c                 8   UR                   (       d  g[        UR                  U R                  R                  5      nUR                   [
        :X  a  UnUnOa[        X2R                   5      nUR                  UR                   5      n[        R                  " U[        R                  5        UR                  nU=(       d    U" 5       nU(       a  U(       d  g[        R                  " Xg5        SUR                  S'   U R                  R                  U5      Ul        g)z!Fill in the body on http_request.Nr  r  )rB   rQ   r@   r?  r   REQUEST_IS_BODYrK   field_by_namer
   r   r   rC   rU   r  r$  r  )	rw   r  r  r  uploadr  
body_value	body_type
body_fields	            r+   	__SetBodyBaseApiService.__SetBody  s    **!++T]]-J-JL&&/9 J$I *E*EFJ%33++-JNN:x'<'<="I  .9;
*z-/A^, MM:::Fr*   c                    [        UR                  U R                  R                  5      n[        R
                  " X'5        U R                  R                  X5      n[        R                  " UR                  S9nU R                  XR                  5        U R                  X5        U R                  XX$5        [        U R                  R                  UR                  S9n	U R!                  UR"                  X#5      U	l        Ub  UR%                  XXU	5        Ub  UR%                  X5        U R'                  XU	R                  S9U	l        U R)                  X5        U R                  R+                  U5      $ )z$Prepares an HTTP request to be sent.)r;   r  )rQ   r@   r?  r   r
   r   r  r	   Requestr;   _BaseApiService__SetBaseHeaders$_BaseApiService__SetBaseSystemParams_BaseApiService__SetBodyri   rd   r8   %_BaseApiService__ConstructQueryParamsr=   ConfigureRequest&_BaseApiService__ConstructRelativePath _BaseApiService__FinalizeRequestr  )
rw   r  r  r   r  rD   downloadr  r  r2  s
             r+   PrepareHttpRequest!BaseApiService.PrepareHttpRequest  s>    "++T]]-J-JLw---..}F#++%113lMM:""<?|GD!MM]-H-HJ#'#>#>&&$@ 
 ##MM%%l@$($@$@+2K2K %A %M!|9}}//==r*   c                    Ub  Ub  [         R                  " S5      eU R                  XX4UU5      nUb  UR                  XpR                  S9  gSnUb  UR                  XpR                  S9nUc  U R                  R                  n	U(       a  UR                  (       a  UR                  n	U R                  R                  U R                  R                  S.n
U R                  R                  (       a  U R                  R                  U
S'   U R                  R                  (       a  U R                  R                  U
S'   [        R                  " X40 U
D6nU R                  XU5      $ )zCall this method with request.Nz/Cannot yet use both upload and download at once)r   )retriesr   r   r   )r   NotYetImplementedErrorr  InitializeDownloadr   InitializeUploadr?  r   
bytes_httpr   r   r   r   r	   MakeRequestProcessHttpResponse)rw   r  r  r   r  rD   r  r  r  r   optss              r+   
_RunMethodBaseApiService._RunMethod  sM    ("6 33AC C ..M= ''[['I"33[[ 4 2M ==%%D&++((==44"&--">">D }}00.2mm.O.O*+}}''%)]]%=%=\"(44,&*,M ''gNNr*   c                 Z    U R                   R                  UU R                  XU5      5      $ )z6Convert an HTTP response to the expected message type.)r?  r  $_BaseApiService__ProcessHttpResponse)rw   r  r  r  s       r+   r  "BaseApiService.ProcessHttpResponse  s.    }},,&&}WMO 	Or*   )__clientr@  rA  r   )NNNN)r   r   r   r   r   rz   r   rE  r   rP  r   rV  rY  r]  r`  r  r  r  r  r  r  r  r  r  r  r  r  r  r)   r   r*   r+   r   r     s    0"
     6 608
9
	
: /3	D
+H0B/G6 HLEI>@ @D=A*OXOr*   r   )$r   ru  r;  r{  r  r  r  	six.movesr   r   apitools.base.protorpcliter   r   r   r   r   r	   r
   __all__	getLoggersetLevelERRORr  Messager   r   r  rQ   r[   r   rg   objectri   r   r   r   r   r*   r+   <module>r     s   " #       !  5 / % ' ) !   % & / / >0H$$ 00+1H$$ +1\ I7"7O& 7Ot
mF m`ZOV ZOr*   