Skip to main content

cflare

Project description

cflare [WIP]

Pythonic Cloudflare Ops

Making Cloudflare a little easier to work with in Python

Most Objects returned from the API are Dataclass Objects, allowing easier manipulation and accessing properties.

Installation

Dependencies: requests, typer, dataclasses-json

pip install --upgrade cflare

Environment Variables

Authentication

  • API User: CFLARE_USER, CLOUDFLARE_USER
  • API Key: CFLARE_KEY, CLOUDFLARE_KEY
  • API Token: CFLARE_TOKEN, CLOUDFLARE_TOKEN

Records Important Note: Content takes priority over IP Address due to how default value is created.

  • Domain Name: CFLARE_DOMAIN, CLOUDFLARE_DOMAIN
  • Subdomain Name: CFLARE_SUBDOMAIN, CLOUDFLARE_SUBDOMAIN
  • Record Type: CFLARE_RECORD, CLOUDFLARE_RECORD, [Default = 'A']
  • IP Address: CFLARE_ADDRESS, CLOUDFLARE_ADDRESS, [Default = Host IP Address]
  • Content: CFLARE_CONTENT, CLOUDFLARE_CONTENT
  • TTL: CFLARE_TTL, CLOUDFLARE_TTL, [Default = 1 or Auto]
  • Proxied: CFLARE_PROXIED, CLOUDFLARE_PROXIED, [Default = False]

Quick Start CLI

cflare auth --email user@email.com --key supersecureapikey

# This will sync the Host VM's Public IP Address to A Record app.mydomain.com = 123.123.123 [VM Public IP]
cflare sync --domain mydomain.com --subdomain app

Quick Start API

from cflare import CFlareAPI, CFlareAuth, save_config


# Auth: Optional.
## Save Auth Explicitly. Will be reloaded next time around.
auth = CFlareAuth(api_user='', api_key='') 
save_config(auth.data)

## Pass Auth to the API Explicitly
cfapi = CFlareAPI(auth)

# Or skip the above steps and have it be picked up from environment variables
cfapi = CFlareAPI()

domains = cfapi.all_domains
# ['domain1.com', 'domain2.com'...]

# Pass params explicitly
res = cfapi.sync(domain='', subdomain='', **config)

# Or call and have it be picked up by environment variables
res = cfapi.sync()

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

cflare-0.0.2.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

cflare-0.0.2-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file cflare-0.0.2.tar.gz.

File metadata

  • Download URL: cflare-0.0.2.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.10

File hashes

Hashes for cflare-0.0.2.tar.gz
Algorithm Hash digest
SHA256 4ff3ab1c30206947df8b97f9165e9690717c3f6979ebba8d9d338d7500a581e4
MD5 f1455b398a3464df8256af87866c3840
BLAKE2b-256 1d719902ae04a33ad8a3524d5d3a4f103f08894617b625cebdc2263e468366f1

See more details on using hashes here.

File details

Details for the file cflare-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: cflare-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.10

File hashes

Hashes for cflare-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d7bfaf1332b8fae40badae3d3abc520c2638f706ad9dcdf92e35d3694cf53a54
MD5 c9d762eaaafbe6d886e8c0d35a8f7d81
BLAKE2b-256 2ee2f63a58402c4e043c98ed7fd1786812e31c1851be323b5aad68076242bf34

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