Мне нужно подключиться к этому uri: uri = 'https://www.wfs.nrw.de/geobasis/wfs_nw_inspire-flurstuecke_alkis?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&STOREDQUERY_ID=urn: og c: def: запрос: OG C -WFS :: GetFeatureById & ID = CadastralParcel_05518904700963 ______ '
Поскольку это не работает, я попробовал это, чтобы найти мои ошибки:
import requests
import urllib.request
uri = 'http://www.google.de'
uriS = 'https://www.google.de'
myproxies = urllib.request.getproxies()
try:
r = requests.get(uri)
print('HTTP OK')
except:
print('HTTP NOT OK')
try:
r = requests.get(uri, proxies = myproxies)
print('HTTP WITH PROXIES OK')
except:
print('HTTP WITH PROXIES NOT OK')
try:
r = requests.get(uriS)
print('HTTPS OK')
except:
print('HTTPS NOT OK')
try:
r = requests.get(uriS, proxies = myproxies)
print('HTTPS WITH PROXIES OK')
except:
print('HTTPS WITH PROXIES NOT OK')
Это результат:
HTTP OK
HTTP WITH PROXIES OK
HTTPS NOT OK
HTTPS WITH PROXIES NOT OK
Это происходит, когда я делаю это в консоли :
>>> import requests
>>> uri = 'https://www.google.de'
>>> r = requests.get(uri)
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.8\apps\Python37\lib\site-packages\urllib3\connectionpool.py", line 594, in urlopen
self._prepare_proxy(conn)
File "C:\PROGRA~1\QGIS3~1.8\apps\Python37\lib\site-packages\urllib3\connectionpool.py", line 815, in _prepare_proxy
conn.connect()
File "C:\PROGRA~1\QGIS3~1.8\apps\Python37\lib\site-packages\urllib3\connection.py", line 324, in connect
self._tunnel()
File "C:\PROGRA~1\QGIS3~1.8\apps\Python37\lib\http\client.py", line 911, in _tunnel
message.strip()))
OSError: Tunnel connection failed: 407 Proxy Authorization Required
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.8\apps\Python37\lib\site-packages\requests\adapters.py", line 445, in send
timeout=timeout
File "C:\PROGRA~1\QGIS3~1.8\apps\Python37\lib\site-packages\urllib3\connectionpool.py", line 638, in urlopen
_stacktrace=sys.exc_info()[2])
File "C:\PROGRA~1\QGIS3~1.8\apps\Python37\lib\site-packages\urllib3\util\retry.py", line 398, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='www.google.de', port=443): Max retries exceeded with url: / (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authorization Required')))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\PROGRA~1\QGIS3~1.8\apps\Python37\lib\code.py", line 90, in runcode
exec(code, self.locals)
File "<input>", line 1, in <module>
File "<string>", line 3, in <module>
File "C:\PROGRA~1\QGIS3~1.8\apps\Python37\lib\site-packages\requests\api.py", line 72, in get
return request('get', url, params=params, **kwargs)
File "C:\PROGRA~1\QGIS3~1.8\apps\Python37\lib\site-packages\requests\api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "C:\PROGRA~1\QGIS3~1.8\apps\Python37\lib\site-packages\requests\sessions.py", line 512, in request
resp = self.send(prep, **send_kwargs)
File "C:\PROGRA~1\QGIS3~1.8\apps\Python37\lib\site-packages\requests\sessions.py", line 622, in send
r = adapter.send(request, **kwargs)
File "C:\PROGRA~1\QGIS3~1.8\apps\Python37\lib\site-packages\requests\adapters.py", line 507, in send
raise ProxyError(e, request=request)
requests.exceptions.ProxyError: HTTPSConnectionPool(host='www.google.de', port=443): Max retries exceeded with url: / (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authorization Required')))