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 commented Aug 19, 2018

fixes #1189

vasinkd added 2 commits Aug 19, 2018
@tsnoam

This comment has been minimized.

Copy link
Member

tsnoam commented Aug 19, 2018

Thanks. We'll check this out.

@vasinkd

This comment has been minimized.

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 added 2 commits Aug 19, 2018
@vasinkd

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

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!

vasinkd and others added 3 commits Aug 24, 2018
@tsnoam

This comment has been minimized.

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 added 2 commits Sep 8, 2018
@tsnoam tsnoam merged commit f2b0672 into python-telegram-bot:master Sep 8, 2018
1 of 3 checks passed
1 of 3 checks passed
continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
Hound No violations found. Woof!
@tsnoam

This comment has been minimized.

Copy link
Member

tsnoam commented Sep 8, 2018

@vasinkd
Thank you very much for this contribution.

@vasinkd

This comment has been minimized.

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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Member

tsnoam commented Sep 13, 2018

@vasinkd yes please

@vasinkd vasinkd mentioned this pull request Sep 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.