Добрый вечер.
Хочу через прокси iPv6 отправить запрос на сайт и получить код ответа.
Когда отправляю запрос на сайт google.com, то возвращается код 200.
Однако если отправляю запрос на сайт
https://2ip.ru/ или на сайт
https://steamcommunity.com/market/, то вылетает ошибка:
Traceback (most recent call last):
File "C:\Users\ilyam\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 594, in urlopen
self._prepare_proxy(conn)
File "C:\Users\ilyam\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 805, in _prepare_proxy
conn.connect()
File "C:\Users\ilyam\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connection.py", line 308, in connect
self._tunnel()
File "C:\Users\ilyam\AppData\Local\Programs\Python\Python39\lib\http\client.py", line 907, in _tunnel
raise OSError(f"Tunnel connection failed: {code} {message.strip()}")
OSError: Tunnel connection failed: 502 Bad Gateway
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\ilyam\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\adapters.py", line 439, in send
resp = conn.urlopen(
File "C:\Users\ilyam\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\connectionpool.py", line 637, in urlopen
retries = retries.increment(method, url, error=e, _pool=self,
File "C:\Users\ilyam\AppData\Local\Programs\Python\Python39\lib\site-packages\urllib3\util\retry.py", line 399, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='www.steamcommunity.com', port=443): Max retries exceeded with url: / (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 502 Bad Gateway')))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\ilyam\PycharmProjects\steam orders bot\parse_id.py", line 65, in <module>
r = requests.get(f"https://www.steamcommunity.com", proxies=proxies)
File "C:\Users\ilyam\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\api.py", line 75, in get
return request('get', url, params=params, **kwargs)
File "C:\Users\ilyam\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\api.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Users\ilyam\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\ilyam\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "C:\Users\ilyam\AppData\Local\Programs\Python\Python39\lib\site-packages\requests\adapters.py", line 510, in send
raise ProxyError(e, request=request)
requests.exceptions.ProxyError: HTTPSConnectionPool(host='www.steamcommunity.com', port=443): Max retries exceeded with url: / (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 502 Bad Gateway')))
Код:
import requests
proxies = {
'http': 'http://oOAQ6o:89EpI4FXtY@45.89.19.65:4002',
'https': 'https://oOAQ6o:89EpI4FXtY@45.89.19.65:4002'
}
r = requests.get(f"https://www.google.com", proxies=proxies)
print(r.status_code) # 200
url = 'https://steamcommunity.com/market/listings/730/AK-47%20%7C%20Elite%20Build%20%28Field-Tested%29/render/?query=&start=0&count=100&country=RU&language=english¤cy=5'
r = requests.get(url, proxies=proxies)
print(r.status_code) # error
print(r.json())
Почему запрос успешно отправляется на страницу google.com, а на страницу steamcommunity.com - нет? Как можно устранить эту проблему?