Conversation
telegram/utils/helpers.py
Outdated
| '&public_key={}'.format(quote(public_key)) + \ | ||
| '&payload={}'.format(quote(payload)) | ||
| if callback_url: | ||
| url += '&callback_url={}'.format(escape(callback_url)) |
There was a problem hiding this comment.
escape is not correct here, because we need url encoding, not html escape. quote is the correct function
telegram/utils/helpers.py
Outdated
| callback_url (:obj:`str`, optional): URL to which the user will be redirected. | ||
|
|
||
| """ | ||
| url = 'tg://resolve?domain=telegrampassport' + \ |
There was a problem hiding this comment.
A tg://resolve url is no longer clickable on Telegram. We can use t.me/telegrampassport to send a clickable url with the same functionality on telegram. But this url only works on Telegram Desktop.
There was a problem hiding this comment.
Any way to do it on mobile at all?
There was a problem hiding this comment.
Unfortunately, no. The t.me/telegrampassport url seems more like a bug in the username resolve process of Telegram Desktop. I already contacted Telegram Support and the bot Support. Telegram support didn't know anything about why the links are no longer clickable. Bot support did not reply yet.
There was a problem hiding this comment.
@code1mountain Any updates on this?
There was a problem hiding this comment.
I'm just gonna remove the function for now. We can always add it in the future if we figure out how to do it properly.
(this should be okay since we haven't released it yet)
telegram/utils/helpers.py
Outdated
| """ | ||
| url = 'tg://resolve?domain=telegrampassport' + \ | ||
| '&bot_id={}'.format(bot_id) + \ | ||
| '&scope={}'.format(quote(scope)) + \ |
There was a problem hiding this comment.
quote somehow doesn't work to escape a list
There was a problem hiding this comment.
Yea, we'll probably have to do like ','.join([quote(s) for s in scope]) it seems
| digest.update(data) | ||
| data_hash = digest.finalize() | ||
| if data_hash != hash: | ||
| raise TelegramDecryptionError("Hashes are not equal! {} != {}".format(data_hash, hash)) |
There was a problem hiding this comment.
The bot completely hangs up in polling mode if this error occurs, because it is raised when receiving the update and and it can't go on with the other updates. Even a bot restart does not fix it.
There was a problem hiding this comment.
Oh that's real bad :/ I'll do some debugging when I get time. Thanks :D I should probably write a test for that error too
There was a problem hiding this comment.
I'm not a 100% sure that the test I wrote tests this completely... could you try your test with my latest commits?
Per discussion at: #1168 (review)
Should fix updater hanging in these cases
Eldinnie
left a comment
There was a problem hiding this comment.
Ok so I went over it all.
Made some changes to the docstrings I will push. Some small other changes too.
I think automa(t|g)ically decrypting the passportdata should be done explicit instead of implicit with a previously supplied key. I would like @python-telegram-bot/maintainers opinions on that please.
The docstrings for Passportstuff are still very unclear and copied from one item to another. These need to be fixed. Also the wiki doc needs to be written. (@jsmnbom already had that planned),
Lastly I'[ll try to improve testing. I would prefer the diff to be covered at least 90+%
telegram/passport/credentials.py
Outdated
|
|
||
| class SecureData(TelegramObject): | ||
| """ | ||
| This object represents the credentials required to decrypt encrypted data. |
There was a problem hiding this comment.
This docstrings seems off
telegram/passport/credentials.py
Outdated
|
|
||
| class SecureValue(TelegramObject): | ||
| """ | ||
| This object represents the credentials required to decrypt encrypted value. |
telegram/utils/helpers.py
Outdated
| from html import escape | ||
|
|
||
| try: | ||
| from urllib import quote # noqa: F401 |
There was a problem hiding this comment.
I'm guessing F401 is unused import. But it seems unused. Why is it imported?
There was a problem hiding this comment.
Very good question.... removed :)
| @@ -0,0 +1,82 @@ | |||
| #!/usr/bin/env python | |||
There was a problem hiding this comment.
Regarding the docstrings here. As far as I can see it currently decrypts everything when comming in. So docstrings are off...
|
Merging. Remaining errors are due to non-compliance with official API (missing bot API 4.1). |
Added support for Telegram Passport. See the official announcement on the blog and the manual for details. (Passport #1174)
botAdded support for editing the media content of messages:
Added the field
thumbto the Audio object to contain the thumbnail of the album cover to which the music file belongs. (Allow multiple inputfiles in requests #1184)Added support for attaching custom thumbnails to uploaded files. For animations, audios, videos and video notes, which are less than 10 MB in size, thumbnails are generated automatically. (Allow multiple inputfiles in requests #1184)
tg:// URLs now can be used in inline keyboard url buttons and text_link message entities. (no need for change)
Added the method sendAnimation, which can be used instead of sendDocument to send animations, specifying their duration, width and height. (Animation #1172)
botAdded the field animation to the Message object. For backward compatibility, when this field is set, the document field will be also set. (Animation #1172)
MessageAdded two new MessageEntity types: cashtag and phone_number. (New msg entities #1187)
MessageEntityAdded support for Foursquare venues: (Adding foursquare_type field to Venue #1170)
foursquare_typeto the object Venuefoursquare_typeto the object InlineQueryResultVenuefoursquare_typeto the object InputVenueMessageContentfoursquare_typeto the sendVenue method in bot.You can now create inline mentions of users, who have pressed your bot's callback buttons. (no change needed)
You can now use the Retry-After response header to configure the delay after which the Bot API will retry the request after an unsuccessful response from a webhook. (Not implemented)
Added vCard support when sharing contacts: (Add vCard field to Contact and related #1166)
Closes #1165