Skip to main content

A Cloudflare API wrapper for Python with asyncio support

Project description

PyPI Status Python Version License

Tests Codecov

pre-commit Black

Inspired by the offical python-cloudflare library developed by Cloudflare. This project is created to be compatible with asyncio for non-blocking IO.

For sync code, it is recommanded to use python-cloudflare via pip install python-cloudflare as it is used by hundreds and offically maintained by Cloudflare. This ensure that APIs are always updated according to Cloudflare API release.

NOTE: This library is in Pre-Alpha, this means things might break. Do not use it in Production unless you have tested on the API route specific to your use case and that would be at your own risk.

Having said that, do submit an issue if you encounter any bug so we can move away from the Alpha stage sooner.

Features

  • async http API call using modern http library httpx.

  • Autocompletion on IDE.

  • Fully type hinted.

Feature Roadmap

  • to support cert token

  • to support sync API client

  • to get to 100% test coverage

Requirements

  • Python 3.9+

Installation

You can install aiocloudflare via pip from PyPI:

$ pip install aiocloudflare

Usage

from aiocloudflare import Cloudflare

async def get_zone():
    async with Cloudflare() as cf:
        result = await cf.zones.get()

Full configuration can be done using Config() class.

from aioCloudflare import Cloudflare, Config

config = Config(email="your@email.com", token="<secret>")
async def get_zone():
    async with Cloudflare(config=config) as cf:
        result = await cf.zones.get()

Configuration can also be stored in a .env file for a “global configuration without needing to create a Config() class. Keys available are:

CF_API_EMAIL=""
CF_API_KEY=""
CF_API_CERTKEY=""
CF_API_URL=""
DEBUG=false
CF_PROFILE=""
USER_AGENT=""

Contributing

Contributions are very welcome. To learn more, see the Contributor Guide.

License

Distributed under the terms of the MIT license, Hello World is free and open source software.

Issues

If you encounter any problems, please file an issue along with a detailed description.

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

aiocloudflare-0.1.3a0.tar.gz (33.8 kB view details)

Uploaded Source

Built Distribution

aiocloudflare-0.1.3a0-py3-none-any.whl (166.9 kB view details)

Uploaded Python 3

File details

Details for the file aiocloudflare-0.1.3a0.tar.gz.

File metadata

  • Download URL: aiocloudflare-0.1.3a0.tar.gz
  • Upload date:
  • Size: 33.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7

File hashes

Hashes for aiocloudflare-0.1.3a0.tar.gz
Algorithm Hash digest
SHA256 d0279aae439b1dfa43329a22eef0aebe74cb658b388ba3a51fa388b0cb715a6f
MD5 1a93c3a3b81528a83eed50dd1792ea42
BLAKE2b-256 852fdec1e0d7d1dffa69e436923a9983748fc08373e6f8dc21b57f84d9c23b75

See more details on using hashes here.

File details

Details for the file aiocloudflare-0.1.3a0-py3-none-any.whl.

File metadata

  • Download URL: aiocloudflare-0.1.3a0-py3-none-any.whl
  • Upload date:
  • Size: 166.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7

File hashes

Hashes for aiocloudflare-0.1.3a0-py3-none-any.whl
Algorithm Hash digest
SHA256 dff7a98be004a06c0bb2623d0b77e8dd19096f8625e755b59843790dbe1634e5
MD5 eee0825fbe70d8214c8668229e4bca59
BLAKE2b-256 9d72e0cfd210017c1fea20518dc396ab841c007d387e818dc8647c9bfe94b038

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