3
ãdeÊ  ã               @   s0   d dl Z d dlZejeƒZddd„Zdd„ ZdS )é    Nc             C   s2   t jjddƒjddƒjƒ }|r"|S | r.t| ƒS d S )NZREGION_NAMEÚ ú )ÚosÚenvironÚgetÚreplaceÚlowerÚ_detect_region_of_azure_vm)Úhttp_clientZregion© r   úB/var/www/agendate/envp3/lib/python3.6/site-packages/msal/region.pyÚ_detect_region   s    r   c          
   C   sT   d}t jdj|ƒƒ y| j|ddid�}W n   t jdj|ƒƒ d S |jjƒ S d S )Nz\http://169.254.169.254/metadata/instance/compute/location?format=text&api-version=2021-01-01a7  Connecting to IMDS {}. It may take a while if you are running outside of Azure. You should consider opting in/out region behavior on-demand, by loading a boolean flag "is_deployed_in_azure" from your per-deployment config and then do "app = ConfidentialClientApplication(..., azure_region=is_deployed_in_azure)"ZMetadataÚtrue)Úheadersz5IMDS {} unavailable. Perhaps not running in Azure VM?)ÚloggerÚinfoÚformatr   ÚtextÚstrip)r
   ÚurlÚrespr   r   r   r	      s    
r	   )N)r   ÚloggingÚ	getLoggerÚ__name__r   r   r	   r   r   r   r   Ú<module>   s   

	