Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaces http.server with Tornado #1191

Merged
merged 11 commits into from
Sep 8, 2018

Conversation

vasinkd
Copy link
Contributor

@vasinkd vasinkd commented Aug 19, 2018

fixes #1189

@tsnoam
Copy link
Member

tsnoam commented Aug 19, 2018

Thanks. We'll check this out.

@vasinkd
Copy link
Contributor Author

vasinkd commented Aug 19, 2018

Sure. Thank you for supporting this great library! BTW, I didn't spend time on fixing of tests since you may still decide to fix this issue with http.server, just made minimal working solution.

@vasinkd
Copy link
Contributor Author

vasinkd commented Aug 21, 2018

Ok. I guess it is almost the final version.

This code can be executed with Python 2.7, Python 3.4+ and (probably) PyPy.
It fixes #1189

Now it returns a little different HTTP status codes: 500 (used to be 403) if Content-Length header is not readable and 404 (used to be 200, why?) if someone uses not POST-request or incorrect URL. It may be easily changed if necessary.

Also, SSL-Certificate check is provided by ssl_ctx.load_cert_chain(cert, key) which has OpenSSL under the hood. I removed _check_ssl_cert function in favor of this method.

I didn't understand what to do with tests aimed at Telegram API 4.0 coverage. Should I comment them out?

@tsnoam
Copy link
Member

tsnoam commented Aug 21, 2018

@vasinkd Thanks. I'm on vacation until next week so I will be able to properly review the code only then.

Regarding the API unitests, just ignore them for now.

@vasinkd
Copy link
Contributor Author

vasinkd commented Aug 21, 2018

@tsnoam Ok. I'll leave the code as it is until you review it.
Enjoy your vacation!

@tsnoam
Copy link
Member

tsnoam commented Sep 8, 2018

Sorry for the delay.

  1. I like it. IMHO, we should get this solution into the library.
  2. We'll need to work on py2.7 compatibility. Specifically I think we should use the Tornado eventloop (instead of asyncio's).
  3. I merged latest master and pushed. Lets see which unitests pass and which needs to be fixed.

@tsnoam tsnoam merged commit f2b0672 into python-telegram-bot:master Sep 8, 2018
@tsnoam
Copy link
Member

tsnoam commented Sep 8, 2018

@vasinkd
Thank you very much for this contribution.

@vasinkd
Copy link
Contributor Author

vasinkd commented Sep 13, 2018

I believe that I found out that answer 200 for GET request was there for a reason :)
Actually, get_webhook_info will always return an error with the code above.

@vasinkd
Copy link
Contributor Author

vasinkd commented Sep 13, 2018

I added a fix to the branch "vasinkd:tornado_webhook".
Should I open a new PR?

@tsnoam
Copy link
Member

tsnoam commented Sep 13, 2018

@vasinkd yes please

@vasinkd vasinkd mentioned this pull request Sep 13, 2018
@github-actions github-actions bot locked and limited conversation to collaborators Aug 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Anyone can block your bot when using webhooks
2 participants