'Bing Maps API refuse my connection in office internet environment
I can run my code and connect to Bing Map API normally in my home after disconnect vpn on my company laptop when I work from home, but after I come to office, I have to connect my company WIFI and I can't connect to Bing Map API. how to solve the issue ? the error message The code
coordinate_url=[]
for index,row in df.iterrows():
url="http://dev.virtualearth.net/REST/v1/Locations?CountryRegion=" + str(row["Country Code"]) +"&adminDistrict="+str(row["State"])+"&postalCode=" + str(row['Postcode']) + "&locality=" + str(row['City']) + "&maxResults=1&key=" + Api_key
r = requests.get(url)
results = json.loads(r.content)
coordinate_url.append(results)
i have solve the problem ,actually it will easy, below is my code. i get the code from this paper. https://www.zyte.com/blog/python-requests-proxy/ . Actually I only need indicate the proxy_port and proxy_host of my company when I send a request to http to scrape content. Then I can use Bing Map API in my company Internet environment
import requests
url = "http://httpbin.org/ip"
proxy_host = "proxy.crawlera.com"
proxy_port = "8010"
proxy_auth = ":"
proxies = {
"https": "https://{}@{}:{}/".format(proxy_auth, proxy_host, proxy_port),
"http": "http://{}@{}:{}/".format(proxy_auth, proxy_host, proxy_port)
}
r = requests.get(url, proxies=proxies, verify=False)
Solution 1:[1]
This is most likely an issue with your company’s firewall. Go talk to your IT team and get dev.virtualearth.net added to the allow list.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Jeremy Caney |
