pyTelegramBotAPI icon indicating copy to clipboard operation
pyTelegramBotAPI copied to clipboard

Fix incorrect webhook URL port in aiohttp examples

Open Y-T-G opened this issue 3 years ago • 9 comments

Description

Updated examples to use default port in webhook URL. Resolves issues such as this.

Describe your tests

Tested by deploying on Heroku with the above change. Webhook running fine.

Python version: 3.10.7

OS: Ubuntu 20.04

Checklist:

  • [x] I added/edited example on new feature/change (if exists)
  • [x] My changes won't break backward compatibility
  • [x] I made changes both for sync and async

Y-T-G avatar Sep 12 '22 20:09 Y-T-G

Why you decided that if you cannot deploy this example to Heroku (one of quite specific services) - the example is incorrect and should be updated?

If you want to have specific Heroku example - make one. Or add HEROKU define for ones who want to use it on Heroku...

Badiboy avatar Sep 13 '22 06:09 Badiboy

@Badiboy Why would one need to specify a port in the webhook URL that is going to be used by Telegram API? The only port that needs to be specified is the port that the application is going to be listening to.

Y-T-G avatar Sep 13 '22 07:09 Y-T-G

@Y-T-G Because you may have multiple bots or other services on one IP.

Badiboy avatar Sep 13 '22 12:09 Badiboy

Those who need it will edit example under their needs;

coder2020official avatar Sep 14 '22 15:09 coder2020official

@Badiboy @coder2020official Okay, how about I separate external and internal port in two different variables,, since the external port can only be 80, 443, 88 and 8443, while the internal port that webserver listens to can be anything?

Y-T-G avatar Sep 15 '22 08:09 Y-T-G

since the external port can only be 80, 443, 88 and 8443

External prots can be absolutely any port. Where did you get it?

Badiboy avatar Sep 16 '22 06:09 Badiboy

image Ig he is talking about this thing. Btw, this is not a MISTAKE. Anyone who does not need port - can edit example under their needs; Not on the official repo;

coder2020official avatar Sep 16 '22 16:09 coder2020official

Where did you get it

@coder2020official You are right. Sorry, I forget that I manage channels with different hook URL, not port.

Badiboy avatar Sep 16 '22 16:09 Badiboy

@Y-T-G you can use this for heroku:

int(os.environ.get('PORT', 5000))

byehack avatar Sep 17 '22 10:09 byehack

@coder2020official It's not really clear from the examples that one could use a different internal port since there's no differentiation being done between the external and internal ports. A single define sets both the internal and external ports.

Y-T-G avatar Sep 22 '22 12:09 Y-T-G

Other examples have it as well. No need to edit examples: examples show basic usage. For further needs, user should edit the example under his/her needs.

coder2020official avatar Sep 23 '22 10:09 coder2020official

Enough, sorry.

Badiboy avatar Sep 23 '22 11:09 Badiboy