domlysz / BlenderGIS

Blender addons to make the bridge between Blender and geographic data
GNU General Public License v3.0
7.71k stars 1.35k forks source link

[Feature request] Behind a proxy #345

Open matslemmens opened 4 years ago

matslemmens commented 4 years ago

Blender and OS versions

Blender 2.83 Windows 10

Describe the bug

When trying to import base maps or any of the information where the addon needs to contact a website/online database. It gets blocked because of the proxy i'm behind. I presume i'm not the only one and maybe it could be a Blender issue instead of an issue with the addon. Then i'm sorry for this request.

It would be nice to be able to add a proxy-server-url in the settings of the addon for example. That way it might be possible to rout the internet-traffic through the right proxy.

I saw that it might be possible in python via 'import request' and then you can list certain proxy servers and so on (source: https://blog.scrapinghub.com/python-requests-proxy)

I'm not a programmer, i just dabble around in python scripts from time to time but if you could point me in the direction of the right part of the code, i can try to build something myself. It would take some time and would probably be not the best of coding-examples...

I'm willing to try testversions if you want/need that.

How to Reproduce

Be behind a proxy and try to use the addon to download basemaps.

Error message

DEBUG:BlenderGIS-master.operators.view3d_mapviewer:201:Bounding box request : (-222525922.72871023, -99091740.47644994, 222525922.72871023, 99091740.47644994) DEBUG:BlenderGIS-master.core.basemaps.mapservice:724:65 tiles requested, 0 already in cache, 65 remains to download DEBUG:BlenderGIS-master.core.basemaps.mapservice:578:http://mt0.google.com/vt/lyrs=s&x=0&y=0&z=0 ERROR:BlenderGIS-master.core.basemaps.mapservice:588:Can't download tile x0 y0. Error DEBUG:BlenderGIS-master.core.basemaps.mapservice:598:Invalid tile data for request http://mt0.google.com/vt/lyrs=s&x=0&y=0&z=0

ojhakumargaurav commented 1 year ago

(https://docs.python.org/3.5/howto/urllib2.html#proxies) Urllib will automatically detect proxies set up in the environment - so one can just set the HTTP_PROXY variable either in your environment e.g. for Bash: export HTTP_PROXY=http://proxy_url:proxy_port or just set it using windows UI.