mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-04 04:00:18 +03:00
Rename package to telethon_aio and prepare for PyPi
This commit is contained in:
parent
d5c5c3cff1
commit
cde314fc21
14
README.rst
14
README.rst
|
@ -2,7 +2,8 @@ Telethon
|
||||||
========
|
========
|
||||||
.. epigraph::
|
.. epigraph::
|
||||||
|
|
||||||
⭐️ Thanks **everyone** who has starred the project, it means a lot!
|
This is the ``asyncio`` version of the library. If you don't know how
|
||||||
|
to work with it, `see here https://pypi.python.org/pypi/Telethon`__.
|
||||||
|
|
||||||
**Telethon** is Telegram client implementation in **Python 3** which uses
|
**Telethon** is Telegram client implementation in **Python 3** which uses
|
||||||
the latest available API of Telegram.
|
the latest available API of Telegram.
|
||||||
|
@ -22,7 +23,12 @@ Installing
|
||||||
|
|
||||||
.. code:: sh
|
.. code:: sh
|
||||||
|
|
||||||
pip3 install telethon
|
pip3 install telethon-aio
|
||||||
|
|
||||||
|
.. warning::
|
||||||
|
|
||||||
|
Be careful **not** to install ``telethon-asyncio`` or other
|
||||||
|
variants, someone else name-squatted those and are unofficial!
|
||||||
|
|
||||||
|
|
||||||
Creating a client
|
Creating a client
|
||||||
|
@ -31,7 +37,7 @@ Creating a client
|
||||||
.. code:: python
|
.. code:: python
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
from telethon import TelegramClient
|
from telethon_aio import TelegramClient
|
||||||
|
|
||||||
# These example values won't work. You must get your own api_id and
|
# These example values won't work. You must get your own api_id and
|
||||||
# api_hash from https://my.telegram.org, under API Development.
|
# api_hash from https://my.telegram.org, under API Development.
|
||||||
|
@ -53,7 +59,7 @@ if you're new with ``asyncio``.
|
||||||
|
|
||||||
.. code:: python
|
.. code:: python
|
||||||
|
|
||||||
print(client.get_me().stringify())
|
print((await client.get_me()).stringify())
|
||||||
|
|
||||||
await client.send_message('username', 'Hello! Talking to you from Telethon')
|
await client.send_message('username', 'Hello! Talking to you from Telethon')
|
||||||
await client.send_file('username', '/home/myself/Pictures/holidays.jpg')
|
await client.send_file('username', '/home/myself/Pictures/holidays.jpg')
|
||||||
|
|
17
setup.py
17
setup.py
|
@ -37,11 +37,11 @@ class TempWorkDir:
|
||||||
os.chdir(self.original)
|
os.chdir(self.original)
|
||||||
|
|
||||||
|
|
||||||
ERROR_LIST = 'telethon/errors/rpc_error_list.py'
|
ERROR_LIST = 'telethon_aio/errors/rpc_error_list.py'
|
||||||
ERRORS_JSON = 'telethon_generator/errors.json'
|
ERRORS_JSON = 'telethon_generator/errors.json'
|
||||||
ERRORS_DESC = 'telethon_generator/error_descriptions'
|
ERRORS_DESC = 'telethon_generator/error_descriptions'
|
||||||
SCHEME_TL = 'telethon_generator/scheme.tl'
|
SCHEME_TL = 'telethon_generator/scheme.tl'
|
||||||
GENERATOR_DIR = 'telethon/tl'
|
GENERATOR_DIR = 'telethon_aio/tl'
|
||||||
IMPORT_DEPTH = 2
|
IMPORT_DEPTH = 2
|
||||||
|
|
||||||
|
|
||||||
|
@ -88,12 +88,12 @@ def main():
|
||||||
from subprocess import run
|
from subprocess import run
|
||||||
from shutil import rmtree
|
from shutil import rmtree
|
||||||
|
|
||||||
for x in ('build', 'dist', 'Telethon.egg-info'):
|
for x in ('build', 'dist', 'Telethon_aio.egg-info'):
|
||||||
rmtree(x, ignore_errors=True)
|
rmtree(x, ignore_errors=True)
|
||||||
run('python3 setup.py sdist', shell=True)
|
run('python3 setup.py sdist', shell=True)
|
||||||
run('python3 setup.py bdist_wheel', shell=True)
|
run('python3 setup.py bdist_wheel', shell=True)
|
||||||
run('twine upload dist/*', shell=True)
|
run('twine upload dist/*', shell=True)
|
||||||
for x in ('build', 'dist', 'Telethon.egg-info'):
|
for x in ('build', 'dist', 'Telethon_aio.egg-info'):
|
||||||
rmtree(x, ignore_errors=True)
|
rmtree(x, ignore_errors=True)
|
||||||
|
|
||||||
elif len(argv) >= 2 and argv[1] == 'fetch_errors':
|
elif len(argv) >= 2 and argv[1] == 'fetch_errors':
|
||||||
|
@ -109,16 +109,17 @@ def main():
|
||||||
with open('README.rst', encoding='utf-8') as f:
|
with open('README.rst', encoding='utf-8') as f:
|
||||||
long_description = f.read()
|
long_description = f.read()
|
||||||
|
|
||||||
with open('telethon/version.py', encoding='utf-8') as f:
|
with open('telethon_aio/version.py', encoding='utf-8') as f:
|
||||||
version = re.search(r"^__version__\s*=\s*'(.*)'.*$",
|
version = re.search(r"^__version__\s*=\s*'(.*)'.*$",
|
||||||
f.read(), flags=re.MULTILINE).group(1)
|
f.read(), flags=re.MULTILINE).group(1)
|
||||||
setup(
|
setup(
|
||||||
name='Telethon',
|
name='Telethon-aio',
|
||||||
version=version,
|
version=version,
|
||||||
description="Full-featured Telegram client library for Python 3",
|
description="Full-featured Telegram client library for Python 3, "
|
||||||
|
"modified to work under Python's asyncio module.",
|
||||||
long_description=long_description,
|
long_description=long_description,
|
||||||
|
|
||||||
url='https://github.com/LonamiWebs/Telethon',
|
url='https://github.com/LonamiWebs/Telethon/tree/asyncio',
|
||||||
download_url='https://github.com/LonamiWebs/Telethon/releases',
|
download_url='https://github.com/LonamiWebs/Telethon/releases',
|
||||||
|
|
||||||
author='Lonami Exo',
|
author='Lonami Exo',
|
||||||
|
|
|
@ -170,7 +170,7 @@ def generate_code(output, json_file, errors_desc):
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
if input('generate (y/n)?: ').lower() == 'y':
|
if input('generate (y/n)?: ').lower() == 'y':
|
||||||
generate_code('../telethon/errors/rpc_error_list.py',
|
generate_code('../telethon_aio/errors/rpc_error_list.py',
|
||||||
'errors.json', 'error_descriptions')
|
'errors.json', 'error_descriptions')
|
||||||
elif input('fetch (y/n)?: ').lower() == 'y':
|
elif input('fetch (y/n)?: ').lower() == 'y':
|
||||||
fetch_errors('errors.json')
|
fetch_errors('errors.json')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user