aiograph - asynchronous Python Telegra.ph API wrapper.
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).
$ pip install -U aiograph
$ git clone https://github.com/aiogram/aiograph.git
$ cd aiograph
$ python setup.py install
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', '<p><strong>Hello, world!</strong></p>')
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
- News: @aiogram_live
- Community: @aiogram
- Russian community: @aiogram_ru
- Pip: aiograph
- Source: Github repo
- Issues/Bug tracker: Github issues tracker