https://github.com/aiogram/aiograph
Asynchronous Python Telegra.ph API wrapper.
https://github.com/aiogram/aiograph
asyncio python telegraph telegraph-api
Last synced: 10 months ago
JSON representation
Asynchronous Python Telegra.ph API wrapper.
- Host: GitHub
- URL: https://github.com/aiogram/aiograph
- Owner: aiogram
- License: mit
- Created: 2018-05-05T12:20:01.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2024-06-21T13:00:23.000Z (about 2 years ago)
- Last Synced: 2025-04-09T21:26:51.751Z (about 1 year ago)
- Topics: asyncio, python, telegraph, telegraph-api
- Language: Python
- Homepage: https://pypi.org/project/aiograph
- Size: 214 KB
- Stars: 66
- Watchers: 9
- Forks: 16
- Open Issues: 10
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
AIOGraph
========
|shield-pypi| |shield-pypi-status| |shield-travis| |shield-codecov| |shield-license|
**aiograph** - asynchronous Python Telegra.ph API wrapper.
Annotations
-----------
The Telegraph class (``aiograph.Telegraph``) encapsulates all API calls in a single class.
It provides functions such as create_page, get_views and other's methods described at `Telegra.ph/api `_ page
All data types stored In the package ``aiograph.types``.
All methods are named following the `PEP-8 `_ instructions
for example ``create_account`` for ``createAccount`` method and etc.
All API methods are awaitable and can be called only inside Event-loop.
Also if you want to upload the file to Telegra.ph service use ``upload`` method
from the instance of Telegraph class.
By the end of all actions you will need to close HTTP connections by calling the `close()` method (is awaitable).
Installation
------------
Using PIP
~~~~~~~~~
.. code-block:: bash
$ pip install -U aiograph
From sources
~~~~~~~~~~~~
.. code-block:: bash
$ git clone https://github.com/aiogram/aiograph.git
$ cd aiograph
$ python setup.py install
Usage examples
--------------
`Basics `_
.. code-block:: python3
import asyncio
from aiograph import Telegraph
loop = asyncio.get_event_loop()
telegraph = Telegraph()
async def main():
await telegraph.create_account('aiograph-demo')
page = await telegraph.create_page('Demo', '
Hello, world!
')
print('Created page:', page.url)
if __name__ == '__main__':
try:
loop.run_until_complete(main())
except (KeyboardInterrupt, SystemExit):
pass
finally:
loop.run_until_complete(telegraph.close()) # Close the aiohttp.ClientSession
Links
-----
- News: `@aiogram_live `_
- Community: `@aiogram `_
- Russian community: `@aiogram_ru `_
- Pip: `aiograph `_
- Source: `Github repo `_
- Issues/Bug tracker: `Github issues tracker `_
.. |shield-pypi| image:: https://img.shields.io/pypi/v/aiograph.svg?style=flat-square
:target: https://pypi.org/project/aiograph/
:alt: PyPI
.. |shield-pypi-status| image:: https://img.shields.io/pypi/status/aiograph.svg?style=flat-square
:target: https://pypi.org/project/aiograph/
:alt: PyPi status
.. |shield-travis| image:: https://img.shields.io/travis/aiogram/aiograph.svg?branch=master&style=flat-square
:target: https://travis-ci.org/aiogram/aiograph
:alt: Travis-CI
.. |shield-codecov| image:: https://img.shields.io/codecov/c/github/aiogram/aiograph.svg?style=flat-square
:target: https://codecov.io/gh/aiogram/aiograph
:alt: Codecov
.. |shield-license| image:: https://img.shields.io/pypi/l/aiogram.svg?style=flat-square
:target: https://opensource.org/licenses/MIT
:alt: MIT License