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.2.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

aiograph-0.2-py3-none-any.whl (15.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aiograph-0.2.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for aiograph-0.2.tar.gz
Algorithm Hash digest
SHA256 e44afe92bd0c73f056f36dae47424a0fcc277d28f9783049408b1e8e5b9b5a1e
MD5 acbe08d2f8bf8dccb1a76212a5e306bd
BLAKE2b-256 9448d91daec35f93e7c314ecee78fe5e89eb5e9ac16bfc17bb9ddffed5a98022

See more details on using hashes here.

File details

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

File metadata

  • Download URL: aiograph-0.2-py3-none-any.whl
  • Upload date:
  • Size: 15.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for aiograph-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d0db6bf351ae1eb874f7f041d031e3882df781159200d8334dc6b732e6f7bcb2
MD5 8cfd44a22c250fee4da3f8100e1c2a01
BLAKE2b-256 332367e592fb8115e6c37351e633a797818b98e37f01f08580ed24847b8f3f8f

See more details on using hashes here.

Supported by

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