Created
May 30, 2021 07:38
-
-
Save mishailovic/3bc25bb644642acf371e732f2dafa52f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyrogram import Client | |
import time | |
from telethon.sync import TelegramClient, events | |
api_id = 123465 | |
api_hash = "0123456789abcdef0123456789abcdef" | |
bot_token = "12345:0123456789abcdef0123456789abcdef" | |
file = "test.bin" # generate with $ truncate -s 1500M test.bin | |
username = "onetimeusername" # username to send test files. | |
pyroapp = Client("pyrogram", api_id, api_hash) | |
teleapp = TelegramClient('telethon', api_id, api_hash).start(bot_token=bot_token) | |
async def main(): | |
async with pyroapp: | |
s = time.time() | |
m = await pyroapp.send_document(username, document = file) | |
e = time.time() - s | |
print(f"Pyrogram stats: speed - {1500 / e * 8:.2f} Mbps, time - {round(e)} s") | |
pyroapp.run(main()) | |
async def telesend(): | |
s = time.time() | |
m = await teleapp.send_file(username, file) | |
e = time.time() - s | |
print(f"Telethon stats: speed - {1500 / e * 8:.2f} Mbps, time - {round(e)} s") | |
with teleapp: | |
teleapp.loop.run_until_complete(telesend()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment