my country, telegrams are blocked, so I try to access it through a tor, the ip changes, and the connection to the telegram api does not occur.
import requests
proxies = {
'http': 'socks5://127.0.0.1:9150',
'https': 'socks5://127.0.0.1:9150'
}
url = "https://api.telegram.org/"
url_ip = "http://httpbin.org/ip"
def get_updates_json(request):
response = requests.get(request, proxies=proxies, verify=False)
return response
print(get_updates_json(url_ip).text)
print(get_updates_json(url).text)
Output the following error message
SOCKSHTTPSConnectionPool(host='api.telegram.org', port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1051)')))
import requests
proxies = { 'http': 'socks5h://127.0.0.1:9150', 'https': 'socks5h://127.0.0.1:9150' }
url = "https://api.telegram.org/" url_ip = "http://httpbin.org/ip"
def get_updates_json(request):
response = requests.get(request, proxies=proxies, verify=False)
return response
print(get_updates_json(url_ip).text) print(get_updates_json(url).text)