Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23276

Python telegram bot via proxy with authentification

$
0
0

everyone.

I am trying to create a simple telegram bot. In my country telegram is blocked so I need to work via proxy.

from telegram.ext import Updater         from telegram.ext import CommandHandler  import osdef start(bot, update):    print("Hello")    bot.sendMessage(chat_id=512562849, text="Hello.")REQUEST_KWARGS={'proxy_url': 'http://93.171.217.48:10996','urllib3_proxy_kwargs': {'username': '***','password': '***',    }}updater = Updater(token='<BOT_TOKEN>',                  request_kwargs=REQUEST_KWARGS)  start_handler = CommandHandler('start', start)  updater.dispatcher.add_handler(start_handler)   updater.start_polling()

But I have the next log

Exception in thread updater:...    _HTTPConnection.__init__(self, *args, **kw)TypeError: __init__() got an unexpected keyword argument 'username'

I used the next docs.

The free proxy works ok, but for my goals, it's bad to lose connection time after time. I prefer not to work under VPN either because of some bureaucracy in my company.

Thanks in advance!


Viewing all articles
Browse latest Browse all 23276

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>