You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @jimccann-rh - I've noticed this too and I think its because Microsoft have added code to detect automated downloads. As far as I can tell, they are the only cloud provider that make it difficult to programmatically download their IP ranges.
In any event, for now I've been able to work around the issue by replacing this line with the following:
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36'
}
page = requests.get(url, headers=headers)
However, I suppose I must come up with a more fool proof method.
[jimb0@fedora ~]$ python -c "exec("import tg_ip_lookup\ntg_ip_lookup.cloudlookup.loadCloudProviderData.main('MaxMind License Key')")"
Processing AWS ranges...
Processing GCP ranges...
Processing Azure ranges...
Traceback (most recent call last):
File "", line 1, in
File "", line 2, in
File "/home/jimb0/.local/lib/python3.11/site-packages/tg_ip_lookup/cloudlookup/loadCloudProviderData.py", line 89, in main
azure_public_info = load_networks(lookup_microsoft_download_url('https://www.microsoft.com/en-us/download/confirmation.aspx?id=56519'),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jimb0/.local/lib/python3.11/site-packages/tg_ip_lookup/cloudlookup/loadCloudProviderData.py", line 63, in lookup_microsoft_download_url
download_url = soup.find('a', {'data-bi-containername': 'download retry'})['href']
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
TypeError: 'NoneType' object is not subscriptable
[jimb0@fedora ~]$
The text was updated successfully, but these errors were encountered: