I cannot able to send messages to my bot as I deploy my bot on pythonanywhere. Getting error like cannot to the server due to the reason that telegram is no longer supporting wildcard certificates as mention in the official pythonanywhere blog link to the blog post.Please guys helps me out if anyone knows the soution to this problem
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.telegram.org', port=443): Max retries exceeded with url: /bottokenvalue/sendMessage (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f094debf050>: Failed to establish a new connection: [Errno 101] Network is unreachable'))
2020-01-17 21:58:04,377: Retrying (Retry(total=2, connect=None, read=None, redirect=0, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f094da4c610>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /bottoken/sendMessage
2020-01-17 21:58:05,377: Retrying (Retry(total=1, connect=None, read=None, redirect=0, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f094da4c4d0>: Failed to establish a new connection: [Errno 101] Network is unreachable')': /bottokenbot/sendMessage
2020-01-17 21:58:06,377: Retrying (Retry(total=0, connect=None, read=None, redirect=0, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f094da4c810>: Failed to establish a new connection: [Errno 101] Network is unreachable')':
UPDATE
You can actually deploy to heroku, even with the free account, which appears to use wildcard certificates for a domain like your_app.herokuapp.com
. This is using the library python-telegram-bot
in a webhook configuration, as documented here.
I'm pretty certain heroku's certs are wildcard, so I'm not sure if Telegram have changed their system to allow wildcard certs. Their official documentation still suggests that wildcard certs are not allowed.
Original answer...
This sudden* lack of support for wildcard certs should only affect bots which are built with webhook support (and hosted on a domain with wildcard certs).
There are probably a few options to get round this:
Remove webhook support from your bot. This is probably the least preferable unless it's a low traffic bot / for personal use, and you didn't implement webhook support for a reason. Without webhook support your bot connects to telegrams API as a client, rather than acting as a server which telegram's system connects TO. This connection method is called "Polling".
Shift to a paid python anywhere account, which supports custom domains. With a custom domain you could then configure this with a non-wildcard cert. You can obtain a free certificate from Let's Encrypt.
You could of course take this opportunity to move to another host, but be careful as many similar hosts will only support wildcard certs for their free accounts: anything that gives you a public URL of youraccount.provider.tld
EDIT
(*) I inferreded from this question that the restriction on wildcard certs had suddenly/recently been introduced, however this goes as far back as March 2017, according to this answer. See the official docs for other restrictions on the SSL configuration.