planetlabs / qgis-planet-plugin

Browse, filter, preview and download Planet Inc imagery in QGIS.
https://developers.planet.com/docs/integrations/qgis/
GNU General Public License v2.0
46 stars 10 forks source link

Daily imagery ignores proxy configuration #11

Open mirandadam opened 4 years ago

mirandadam commented 4 years ago

When using the latest version of the plugin with QGis configured to work behind a proxy, monthly mosaics are loaded correctly. However, when trying to load daily imagery, QGis produces an error that is consistent with directly trying to access the service URL and ignoring the proxy configuration.

The problem seems to be at or around line 588 of p_client.py, which directly accesses the "requests" module.

The error message from the QGis log is as follows:

020-10-06T16:09:36     WARNING    Traceback (most recent call last):
              File "C:\PROGRA~1\QGIS3~1.14\apps\Python37\lib\site-packages\urllib3\connection.py", line 160, in _new_conn
              (self._dns_host, self.port), self.timeout, **extra_kw
              File "C:\PROGRA~1\QGIS3~1.14\apps\Python37\lib\site-packages\urllib3\util\connection.py", line 84, in create_connection
              raise err
              File "C:\PROGRA~1\QGIS3~1.14\apps\Python37\lib\site-packages\urllib3\util\connection.py", line 74, in create_connection
              sock.connect(sa)
             ConnectionRefusedError: [WinError 10061] Nenhuma conexão pôde ser feita porque a máquina de destino as recusou ativamente
             
             During handling of the above exception, another exception occurred:
             
             Traceback (most recent call last):
              File "C:\PROGRA~1\QGIS3~1.14\apps\Python37\lib\site-packages\urllib3\connectionpool.py", line 677, in urlopen
              chunked=chunked,
              File "C:\PROGRA~1\QGIS3~1.14\apps\Python37\lib\site-packages\urllib3\connectionpool.py", line 381, in _make_request
              self._validate_conn(conn)
              File "C:\PROGRA~1\QGIS3~1.14\apps\Python37\lib\site-packages\urllib3\connectionpool.py", line 976, in _validate_conn
              conn.connect()
              File "C:\PROGRA~1\QGIS3~1.14\apps\Python37\lib\site-packages\urllib3\connection.py", line 308, in connect
              conn = self._new_conn()
              File "C:\PROGRA~1\QGIS3~1.14\apps\Python37\lib\site-packages\urllib3\connection.py", line 172, in _new_conn
              self, "Failed to establish a new connection: %s" % e
             urllib3.exceptions.NewConnectionError: : Failed to establish a new connection: [WinError 10061] Nenhuma conexão pôde ser feita porque a máquina de destino as recusou ativamente
             
             During handling of the above exception, another exception occurred:
             
             Traceback (most recent call last):
              File "C:\PROGRA~1\QGIS3~1.14\apps\Python37\lib\site-packages\requests\adapters.py", line 449, in send
              timeout=timeout
              File "C:\PROGRA~1\QGIS3~1.14\apps\Python37\lib\site-packages\urllib3\connectionpool.py", line 725, in urlopen
              method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
              File "C:\PROGRA~1\QGIS3~1.14\apps\Python37\lib\site-packages\urllib3\util\retry.py", line 439, in increment
              raise MaxRetryError(_pool, url, error or ResponseError(cause))
             urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='tiles.planet.com', port=443): Max retries exceeded with url: /data/v1/layers (Caused by NewConnectionError(': Failed to establish a new connection: [WinError 10061] Nenhuma conexão pôde ser feita porque a máquina de destino as recusou ativamente'))
             
             During handling of the above exception, another exception occurred:
             
             Traceback (most recent call last):
              File "C:/Users/XXXXXX/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\planet_explorer\gui\pe_search_results.py", line 821, in 
              lambda: self.add_preview_groups([node]))
              File "C:/Users/XXXXXX/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\planet_explorer\gui\pe_search_results.py", line 714, in add_preview_groups
              self.add_preview_groups_for_items(nodes)
              File "C:/Users/XXXXXX/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\planet_explorer\gui\pe_search_results.py", line 784, in add_preview_groups_for_items
              sort_order=self._sort_order
              File "C:/Users/XXXXXX/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\planet_explorer\pe_utils.py", line 560, in create_preview_group
              item_type_ids, api_key, service=tile_service)
              File "C:/Users/XXXXXX/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\planet_explorer\pe_utils.py", line 381, in tile_service_data_src_uri
              item_type_ids, api_key, tile_hash=tile_hash, service=service)
              File "C:/Users/XXXXXX/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\planet_explorer\planet_api\p_client.py", line 621, in tile_service_url
              tile_hash = tile_service_hash(item_type_ids, api_key)
              File "C:/Users/XXXXXX/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\planet_explorer\planet_api\p_client.py", line 588, in tile_service_hash
              res = post(tile_url, auth=(api_key, ''), data=data)
              File "C:\PROGRA~1\QGIS3~1.14\apps\Python37\lib\site-packages\requests\api.py", line 119, in post
              return request('post', url, data=data, json=json, **kwargs)
              File "C:\PROGRA~1\QGIS3~1.14\apps\Python37\lib\site-packages\requests\api.py", line 61, in request
              return session.request(method=method, url=url, **kwargs)
              File "C:\PROGRA~1\QGIS3~1.14\apps\Python37\lib\site-packages\requests\sessions.py", line 530, in request
              resp = self.send(prep, **send_kwargs)
              File "C:\PROGRA~1\QGIS3~1.14\apps\Python37\lib\site-packages\requests\sessions.py", line 643, in send
              r = adapter.send(request, **kwargs)
              File "C:\PROGRA~1\QGIS3~1.14\apps\Python37\lib\site-packages\requests\adapters.py", line 516, in send
              raise ConnectionError(e, request=request)
             requests.exceptions.ConnectionError: HTTPSConnectionPool(host='tiles.planet.com', port=443): Max retries exceeded with url: /data/v1/layers (Caused by NewConnectionError(': Failed to establish a new connection: [WinError 10061] Nenhuma conexão pôde ser feita porque a máquina de destino as recusou ativamente'))
nsp commented 3 years ago

Are you still seeing this issue with version 2.1 of the plugin?

mirandadam commented 3 years ago

I need to check. We have worked around the problem the first time by defining environment variables for QGis to use, but last week I had to revert a plugin installation to a previous version on the machine of one of our team. I am positive that the latest freshest version of the plugin as of Thursday last week smells funny, but I do not know if it's the same issue. I can't provide an estimate on when I will have time to troubleshoot that.