Exemplo n.º 1
0
    def test_send_photo(self):
        m = sendPhoto()
        m.chat_id = env.uid
        m.caption = "Pong to you!"
        m.photo = os.path.join(os.path.dirname(__file__), 'pong.png')

        resp = self._tgclient.post(m)
        print(resp)
Exemplo n.º 2
0
    def test_send_photo(self):
        m = sendPhoto()
        m.chat_id = env.uid
        m.caption = "Pong to you!"
        m.photo = os.path.join(os.path.dirname(__file__), 'pong.png')

        resp = self._tgclient.post(m)
        print(resp)
    def test_send_photo(self):
        m = sendPhoto()
        m.chat_id = env.uid
        m.caption = "What is this?"
        import os
        m.photo = os.path.join(os.path.split(__file__)[0], "test.jpg")

        resp = self._client.send_method(m)
        print(resp)
Exemplo n.º 4
0
    def test_send_photo(self):
        m = sendPhoto()
        m.chat_id = env.uid
        m.caption = "What is this?"
        import os
        m.photo = os.path.join(os.path.split(__file__)[0], "test.jpg")

        resp = self._client.post(m)
        print resp
Exemplo n.º 5
0
    def test_send_photo_by_filename(self):
        m = sendPhoto()
        m.chat_id = env.uid
        m.caption = "What is this?"
        import os
        filename = os.path.join(os.path.split(__file__)[0], "test.jpg")
        m.photo = filename

        resp = yield from self._client.send_method(m)
        print(resp)
    def test_send_photo_by_filehandle(self):
        m = sendPhoto()
        m.chat_id = env.uid
        m.caption = "What is this?"
        import os
        filename = os.path.join(os.path.split(__file__)[0], "test.jpg")
        with open(filename, 'rb') as fh:
            m.photo = fh

            resp = yield from self._client.send_method(m)
            print(resp)
    def test_send_photo_by_bytes(self):
        m = sendPhoto()
        m.chat_id = env.uid
        m.caption = "What is this?"
        import os
        filename = os.path.join(os.path.split(__file__)[0], "test.jpg")
        import io
        import shutil
        bytes = io.BytesIO()
        with open(filename, 'rb') as fh:
            shutil.copyfileobj(fh, bytes)
        bytes.seek(0)
        m.photo = bytes

        resp = yield from self._client.send_method(m)
        print(resp)
Exemplo n.º 8
0
    def test_send_photo_by_bytes(self):
        m = sendPhoto()
        m.chat_id = env.uid
        m.caption = "What is this?"
        import os
        filename = os.path.join(os.path.split(__file__)[0], "test.jpg")
        import io
        import shutil
        bytes = io.BytesIO()
        with open(filename, 'rb') as fh:
            shutil.copyfileobj(fh, bytes)
        bytes.seek(0)
        m.photo = bytes

        resp = yield from self._client.send_method(m)
        print(resp)