A
A
aqau1232021-12-14 21:27:20
Python
aqau123, 2021-12-14 21:27:20

Why does a 407 socks python error occur?

I am writing an asynchronous apishka to tg.
question.

proxy = (socks.HTTP, 'host', port, 'login', 'password')

initialize the client
tg = TG(
                sessionFile=os.path.join(config.SESSIONS, str(data['session_file'])),
                apiId=int(data['app_id']),
                apiHash=str(data['app_hash']),
                proxy=proxy,
                deviceModel=str(data['device']),
                appVersion=str(data['app_version']),
                langCode=str(data['system_lang_pack']).split('-')[0]
            )

look at the back logs. we get. fix profit.
Attempt 1 at connecting failed: ConnectionError: [Errno Proxy error: 407 Proxy Authentication Required] Could not connect to proxy хххххххх:ххххх [407]
Attempt 2 at connecting failed: ConnectionError: [Errno Proxy error: 407 Proxy Authentication Required] Could not connect to proxy хххххххх:ххххх [407]
Attempt 3 at connecting failed: ConnectionError: [Errno Proxy error: 407 Proxy Authentication Required] Could not connect to proxy хххххххх:ххххх [407]
←[32mINFO←[0m:     127.0.0.1:52364 - "←[1mPOST /api/v1/sendMessage HTTP/1.1←[0m" ←[32m200 OK←[0m

why is that so? in the documentation in black and white it is written how to do it.
it's idiots who write docs and libs? Or am I an idiot doing something wrong?
Accounts purchased and expensive. proxy workers a million percent. cost space money. one proxy per month costs 2500 rubles. I tried to enter the cart through the tor - also the same error.
Is that how it turns out?
It was possible to use another lib, but there are no more analogues. If the telethon of the dock is below zero, then the tdlib has pitch darkness there. The script is big, 5000 accounts work simultaneously. We really need proxies.
By googling, I found out that on some dark and godforsaken forum, a person also had such a problem.
He solved it by adding a timeout before establishing a connection, but he did it through tor, tor itself is slow, and these are expensive proxies.
In general, what are the options?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question