Skip to content

Instantly share code, notes, and snippets.

@delivrance
Created May 1, 2020 14:04
Show Gist options
  • Save delivrance/87a9d8cca3e17e86f17e4286e137b833 to your computer and use it in GitHub Desktop.
Save delivrance/87a9d8cca3e17e86f17e4286e137b833 to your computer and use it in GitHub Desktop.
Pyrogram upload speedtest
from pyrogram import Client
import time
app = Client("...")
async def main():
async with app:
m = await app.send_message("pyrogramchat", "uploading 1500 MB...")
s = time.time()
m = await m.reply_document("file.test") # Create with: truncate -s 1500M file.test
e = time.time() - s
await m.reply_text(f"`avg {1500 / e * 8:.2f} Mbps`") # Should be ~250 Mbps
app.run(main())
@shadow443
Copy link

Hello I get this error:
Python version: 3.6.9

 Traceback (most recent call last):
  File "test.py", line 21, in <module>
    app.run(main())
TypeError: run() takes 1 positional argument but 2 were given

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment