
    l h                    *    d Z ddlmZ ddlmZ dddZy)zGCP helpers.    )annotations)Anyc                X   ddl m}m} d}|d|  z  }ddi} |||      }	  |||      5 }|j                  }|j	                         j                  d	      }	d d d        dk7  rd}t        |      t        	      S # 1 sw Y   'xY w# t        $ r}
d
|
z  }t        |      d d }
~
ww xY w)Nr   )RequesturlopenzMhttp://metadata/computeMetadata/v1/instance/service-accounts/default/identityz
?audience=zMetadata-FlavorGoogle)headers)timeoututf8z'Failed to acquire IMDS access token: %s   z$Failed to acquire IMDS access token.)access_token)	urllib.requestr   r   statusreaddecode	Exception
ValueErrordict)resourcer
   r   r   urlr	   requestresponser   bodyemsgs               z/var/www/html/SchoolMeal/SchoolMeal/pds_admin_SchoolMeal/Backend/venv/lib/python3.12/site-packages/pymongo/_gcp_helpers.py_get_gcp_responser      s    /
YCZz""C (+Gc7+G(Wg. 	2(__F==?))&1D	2 }4oT""	2 	2  (7!;o4'(s.   
B
 ,A>B
 >BB
 
	B)B$$B)N)   )r   strr
   floatreturnzdict[str, Any])__doc__
__future__r   typingr   r        r   <module>r'      s     " #r&   