Skip to main content

asynchronous Python Telegra.ph API wrapper

Project description

PyPI PyPi status Travis-CI Codecov MIT License

aiographfix - asynchronous Python Telegra.ph API wrapper, that fix aiograph

Annotations

The Telegraph class (aiographfixed.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 aiographfixed.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 aiographfixed

From sources

$ git clone https://github.com/Lunatik-cyber/aiographfixed.git
$ cd aiographfixed
$ python setup.py install

Usage examples

import asyncio

from aiographfixed import Telegraph

loop = asyncio.get_event_loop()
telegraph = Telegraph()


async def main():
    await telegraph.create_account('aiograph-demo')
    page = await telegraph.create_page(title='Demo', content='<p><strong>Hello, world!</strong></p>', public=True)
    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

aiographfixed-0.3.1.tar.gz (14.8 kB view details)

Uploaded Source

File details

Details for the file aiographfixed-0.3.1.tar.gz.

File metadata

  • Download URL: aiographfixed-0.3.1.tar.gz
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for aiographfixed-0.3.1.tar.gz
Algorithm Hash digest
SHA256 80046e940f8399feb8190d9267fa945e892dc95f22503809cbb4d2114b20dce1
MD5 c3bc88d0afb24c58698e4c92101ddc7f
BLAKE2b-256 832214f80bbf0991ca186cbc1fcb6d8848cd0d53e2400f720b21a49b9bf7702b

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