Skip to content

How to connect telegram api using sock5 Ask #1359

@LeaderMalang

Description

@LeaderMalang

Here is my simple code. I am trying to connect telegram api with my newly created bot.

SOCKS_URL = 'socks5://77.247.94.153:8888/'
SOCKS_USER = ''
SOCKS_PASS = ''
bot = Bot(
    'TOKEN',
    request=Request(
        proxy_url=SOCKS_URL,
        urllib3_proxy_kwargs={
            'username': SOCKS_USER,
            'password': SOCKS_PASS,
        },
    )
)
print(str(bot.get_me().id))

but its always replies

Max retries exceeded with url: /botTOKEN/getMe (Caused by NewConnectionError(': Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known'))

I am able get result using postman but not able to get response using requests. enter image description here
https://i.stack.imgur.com/Fv40Z.png

import requests

url = "https://api.telegram.org/botTOKEN/getMe"



response = requests.request("GET", url)

print(response.text)

anyone has idea then help me Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions