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

add support for 3.5 api #920

Merged
merged 14 commits into from Dec 8, 2017

Conversation

Projects
None yet
2 participants
@Eldinnie
Copy link
Member

Eldinnie commented Nov 21, 2017

As discussed do the current InputMedia* throw a ValueError when supplied with a file instead of a file_id or and url.

This is because the current workings of InputFile and it's mechanics to encode as multipart form data don't support multiple files. And quite frankly, I have no Idea how to do that.

Closes #918

Eldinnie added some commits Nov 21, 2017

Hardcoded values
Appearantly TG decided to change the size of a send image (again)

@python-telegram-bot python-telegram-bot deleted a comment from codecov bot Nov 22, 2017

@python-telegram-bot python-telegram-bot deleted a comment from codecov bot Nov 22, 2017

@python-telegram-bot python-telegram-bot deleted a comment from codecov bot Nov 22, 2017

@python-telegram-bot python-telegram-bot deleted a comment from codecov bot Nov 22, 2017

@Eldinnie Eldinnie requested review from tsnoam and jh0ker Nov 22, 2017

@Eldinnie

This comment has been minimized.

Copy link
Member Author

Eldinnie commented Nov 22, 2017

Review wanted.

@jsmnbom
Copy link
Member

jsmnbom left a comment

Looks really good!
Some small quick notes :)
Then we need to decide if we're gonna release it like this or if we need to get sending new files in groups to work first.

if isinstance(media, PhotoSize):
self.media = media.file_id
elif hasattr(media, 'read'):
raise ValueError('We only support file_id or url as a valid media. Sending files is '

This comment has been minimized.

@jsmnbom

jsmnbom Nov 22, 2017

Member

Maybe add a TODO: about this?

This comment has been minimized.

@Eldinnie

Eldinnie Nov 22, 2017

Author Member

yes, will do

@@ -0,0 +1,31 @@
#!/usr/bin/env python

This comment has been minimized.

@jsmnbom

jsmnbom Nov 22, 2017

Member

Should these files maybe be in files/?

This comment has been minimized.

@Eldinnie

Eldinnie Nov 22, 2017

Author Member

Hmm, maybe.


def test_with_video(self, video):
# fixture found in test_video
imv = InputMediaVideo(video, caption="test 3")

This comment has been minimized.

@jsmnbom

jsmnbom Nov 22, 2017

Member

I don't think we use abbreviations in the other tests

This comment has been minimized.

@Eldinnie

Eldinnie Nov 22, 2017

Author Member

We don;t and I'm lazy, will fix

assert isinstance(messages, list)
assert len(messages) == 2
assert all([isinstance(mes, Message) for mes in messages])
assert all([mes.media_group_id == messages[0].media_group_id for mes in messages])

This comment has been minimized.

@jsmnbom

jsmnbom Nov 22, 2017

Member

Maybe a TODO: about needing to test with new files.

This comment has been minimized.

@Eldinnie

Eldinnie Nov 22, 2017

Author Member

yup

@@ -107,6 +107,8 @@ def check_object(h4):
field = 'from_user'
elif name.startswith('InlineQueryResult') and field == 'type':
continue
elif name.startswith('InputMedia') and field == 'type':

This comment has been minimized.

@jsmnbom

jsmnbom Nov 22, 2017

Member

Could you combine with above?
elif (name.startswith('InlineQueryResult') or name.startswith('InputMedia')) and field == 'type':
seems cleaner to me.

This comment has been minimized.

@Eldinnie

Eldinnie Nov 22, 2017

Author Member

yes, I pondered on it, but I will

assert photo.width == 1920
assert photo.height == 1080
assert photo.file_size == 30907
assert photo.width == 1280

This comment has been minimized.

@jsmnbom

jsmnbom Nov 22, 2017

Member

What changed here?
And how... like it's a smaller image but it takes up more space? :/

This comment has been minimized.

@Eldinnie

Eldinnie Nov 22, 2017

Author Member

I have no Idea, but it's what came back...

@python-telegram-bot python-telegram-bot deleted a comment from codecov bot Dec 5, 2017

@python-telegram-bot python-telegram-bot deleted a comment from codecov bot Dec 5, 2017

Eldinnie added some commits Dec 5, 2017

@python-telegram-bot python-telegram-bot deleted a comment from codecov bot Dec 5, 2017

@python-telegram-bot python-telegram-bot deleted a comment from codecov bot Dec 5, 2017

@python-telegram-bot python-telegram-bot deleted a comment from codecov bot Dec 5, 2017

@Eldinnie

This comment has been minimized.

Copy link
Member Author

Eldinnie commented Dec 5, 2017

I addressed everything @bomjacob pointed out. As discussed I think we should merge and release without the option to send new files yet.

Appveyor will fail due to python 3.3 drop in support from pytest. As will we (see #930) Good to go?

@python-telegram-bot python-telegram-bot deleted a comment from codecov bot Dec 5, 2017

@python-telegram-bot python-telegram-bot deleted a comment from codecov bot Dec 5, 2017

elif name.startswith('InlineQueryResult') and field == 'type':
continue
elif name.startswith('InputMedia') and field == 'type':
elif (name.startswith('InlineQueryResult') or name.startswith('InputMedia')) \

This comment has been minimized.

@jsmnbom

jsmnbom Dec 6, 2017

Member

Could you wrap it all in paranthesis instead of using the backslash here maybe?, doesn't look very clean IMO

This comment has been minimized.

@Eldinnie

Eldinnie Dec 6, 2017

Author Member

👍

@jsmnbom

jsmnbom approved these changes Dec 6, 2017

@python-telegram-bot python-telegram-bot deleted a comment from codecov bot Dec 6, 2017

@python-telegram-bot python-telegram-bot deleted a comment from codecov bot Dec 6, 2017

Eldinnie added some commits Dec 8, 2017

object for provider_data
Make it possible to send an object that will be json-serialized for send_invoice + tests

@Eldinnie Eldinnie force-pushed the 3.5-API branch from 157336a to b1c504f Dec 8, 2017

@python-telegram-bot python-telegram-bot deleted a comment from codecov bot Dec 8, 2017

@python-telegram-bot python-telegram-bot deleted a comment from codecov bot Dec 8, 2017

@python-telegram-bot python-telegram-bot deleted a comment from codecov bot Dec 8, 2017

@python-telegram-bot python-telegram-bot deleted a comment from codecov bot Dec 8, 2017

@Eldinnie Eldinnie merged commit 042d4bb into master Dec 8, 2017

1 of 3 checks passed

continuous-integration/appveyor/pr AppVeyor build failed
Details
continuous-integration/travis-ci/pr The Travis CI build failed
Details
codeclimate All good!
Details

@Eldinnie Eldinnie deleted the 3.5-API branch Dec 8, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.