Skip to main content

asynchronous Python Telegra.ph API wrapper

Project description

PyPI PyPi status Travis-CI Codecov MIT 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

$ pip install -U aiograph

From sources

$ git clone https://github.com/aiogram/aiograph.git
$ cd aiograph
$ python setup.py install

Usage examples

Basics

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiograph-0.1.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aiograph-0.1-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file aiograph-0.1.tar.gz.

File metadata

  • Download URL: aiograph-0.1.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for aiograph-0.1.tar.gz
Algorithm Hash digest
SHA256 3b6bad9e186b57c67fd256c7972468b4dbe85d37b6814cb7750f118053471f33
MD5 674240785f6eec6577fff2d5e627ff16
BLAKE2b-256 08e653fa6c765263d1025059c85ba38cc893e6cbff9f3b042f9f6a4d96370301

See more details on using hashes here.

File details

Details for the file aiograph-0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for aiograph-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5f10e678f9d8a1958e88ef7b0efd7e7686c50ff29e76542734d0ac0d5aa55e52
MD5 17366062fb7c5de86ca56b107e2d7973
BLAKE2b-256 9bd624900ffbb1ec36fb6975f2e9ee0137a9dc8c2bfe3855adbe359709caa2d3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page