Skip to main content

Python client for CloudFlare.

Project description

Build Status

A Python client for CloudFlare API v4 and Host API.

It provides two levels of integration against the CloudFlare API:

  1. A low level API, with one method per API endpoint (pycloudflare.services).

  2. A high level ORM API (pycloudflare.models).

Only a subset of the CloudFlare API is currently supported:

  • Users

  • Zones

  • Zone Settings

  • DNS Records

  • Page Rules

  • User creation & authentication through CloudFlare’s partner-facing Host API.

Usage

Get all our zones at CloudFlare

>>> cf = CloudFlareService(api_key, email)
>>> for domain in cf.get_zones():
>>>     print domain['name'], domain['id']

Configuration

The Host (Partner) API service client is configured when it is instantiated and reads its configuration from configuration.json.

The configuration file should be in the format:

{
    "common": {
        "cloudflare": {
            "api_key": "HOST API KEY HERE",
         }
    }
}

Testing

Install development requirements:

pip install -r requirements.txt

Tests can then be run by doing:

nosetests

The integration tests require a host API key. They can be run with:

nosetests tests/test_integration.py

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

pycloudflare-2.0.0.tar.gz (15.7 kB view details)

Uploaded Source

File details

Details for the file pycloudflare-2.0.0.tar.gz.

File metadata

  • Download URL: pycloudflare-2.0.0.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/3.6.7

File hashes

Hashes for pycloudflare-2.0.0.tar.gz
Algorithm Hash digest
SHA256 ae0371125dd1f8af891c9613e4854629fb96a0ee6791a16516ae5ba8dc13a324
MD5 5593256b674c77bcf5683c9fe31dfd07
BLAKE2b-256 7cb99bcc777b7b44e8988ca12178f2dfa8c8c7fbd61e4a97cec83d8fa6da8279

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