The Wayback Machine - https://web.archive.org/web/20201210054547/https://github.com/pyrogram/pyrogram/pull/286
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 uploading from file pointers #286

Closed
wants to merge 10 commits into from

Conversation

@OctoNezd
Copy link
Contributor

@OctoNezd OctoNezd commented Jul 20, 2019

Fixes #261
image

All file pointers must have attribute .name

Tested methods:

  • send_animated_sticker
  • send_animation
  • send_audio
  • send_document
  • send_photo
  • send_sticker
  • send_video
  • send_video_note
  • send_voice
OctoNezd added 7 commits Jul 20, 2019
@OctoNezd
Copy link
Contributor Author

@OctoNezd OctoNezd commented Jul 20, 2019

Can someone test other methods?

@AyraHikari
Copy link

@AyraHikari AyraHikari commented Aug 2, 2019

All test passed, except for send_voice

  • send_animated_sticker
  • send_animation
  • send_audio
  • send_photo
  • send_video
  • send_video_note
  • send_voice

client.send_voice(c, open("voice.ogg", "rb"))

ERROR:pyrogram.client.ext.dispatcher:'str' object has no attribute 'write'
Traceback (most recent call last):
  File "/home/ayra/.local/share/virtualenvs/test-jenOu_xj/lib/python3.7/site-packages/pyrogram/client/ext/dispatcher.py", line 178, in update_worker
    handler.callback(self.client, *args)
  File "test.py", line 47, in starting_test
    client.send_voice(c, open("voice.ogg", "rb"))
  File "/home/ayra/.local/share/virtualenvs/test-jenOu_xj/lib/python3.7/site-packages/pyrogram/client/methods/messages/send_voice.py", line 161, in send_voice
    **self.parser.parse(caption, parse_mode)
  File "/home/ayra/.local/share/virtualenvs/test-jenOu_xj/lib/python3.7/site-packages/pyrogram/client/client.py", line 1087, in send
    r = self.session.send(data, retries, timeout)
  File "/home/ayra/.local/share/virtualenvs/test-jenOu_xj/lib/python3.7/site-packages/pyrogram/session/session.py", line 437, in send
    return self._send(data, timeout=timeout)
  File "/home/ayra/.local/share/virtualenvs/test-jenOu_xj/lib/python3.7/site-packages/pyrogram/session/session.py", line 403, in _send
    message = self.msg_factory(data)
  File "/home/ayra/.local/share/virtualenvs/test-jenOu_xj/lib/python3.7/site-packages/pyrogram/session/internals/msg_factory.py", line 37, in __call__
    len(body)
  File "/home/ayra/.local/share/virtualenvs/test-jenOu_xj/lib/python3.7/site-packages/pyrogram/api/core/tl_object.py", line 76, in __len__
    return len(self.write())
  File "/home/ayra/.local/share/virtualenvs/test-jenOu_xj/lib/python3.7/site-packages/pyrogram/api/functions/messages/send_media.py", line 104, in write
    b.write(self.media.write())
  File "/home/ayra/.local/share/virtualenvs/test-jenOu_xj/lib/python3.7/site-packages/pyrogram/api/types/input_media_uploaded_document.py", line 84, in write
    b.write(self.file.write())
AttributeError: 'str' object has no attribute 'write'
@OctoNezd
Copy link
Contributor Author

@OctoNezd OctoNezd commented Aug 4, 2019

Fixed send_voice

# Conflicts:
#	pyrogram/client/methods/messages/download_media.py
#	pyrogram/client/methods/messages/send_animated_sticker.py
@delivrance delivrance closed this Jul 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked issues

Successfully merging this pull request may close these issues.

3 participants
You can’t perform that action at this time.
Morty Proxy This is a proxified and sanitized view of the page, visit original site.