mapillary / mapillary-python-sdk

A Python 3 library built on the Mapillary API v4 to facilitate retrieving and working with Mapillary data.
MIT License
37 stars 14 forks source link

Bug Report #148

Open neverland-haha opened 1 year ago

neverland-haha commented 1 year ago

Describe the bug I can use mly.interface.images_in_bbox in api colab, however, when I try to use this api on my local machine,it returns HTTPSConnectionPool(host='tiles.mapillary.com', port=443): Max retries exceeded with url. Perhaps Chinese ban the port or any other reason?

Colab demo result image To Reproduce

local machine result. image

Screenshots image To Reproduce

local machine code

import mapillary as mly
import geopandas as gpd
import os
import requests
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36'}
os.environ['HTTP_PROXY'] = 'http://127.0.0.1:33210'
os.environ['HTTPS_PROXY'] = 'http://127.0.0.1:33210'
mly.interface.set_access_token('MLY|5175886149161658|4099af83a040b4c64a3891bdcc8314cf')
region_dict =  {
     'west': 8.97291281111626,
     'south': 35.35651235634347,
     'east': 9.09945112532228,
     'north': 35.460110419672326
}
result = mly.interface.images_in_bbox(test_dict)

colab demo

import mapillary as mly
import geopandas as gpd
import os
import requests
mly.interface.set_access_token('MLY|5175886149161658|4099af83a040b4c64a3891bdcc8314cf')
region_dict =  {
     'west': 8.97291281111626,
     'south': 35.35651235634347,
     'east': 9.09945112532228,
     'north': 35.460110419672326
}
result = mly.interface.images_in_bbox(region_dict)
Rubix982 commented 1 year ago

Your local machine's internet access blocks your request and thus your connection with the API service, hence the 443 error.

Using the os.environ variables as you have set don't really have much impact. In the end, the local network address you are on is 127.0.0.1. It is rather the internet service you are connected to that does not let your machine send a request to the API service. Nothing to be fixed via the code here.