Skip to content
This repository has been archived by the owner on Jan 20, 2018. It is now read-only.

Latest commit

 

History

History
90 lines (59 loc) · 2.43 KB

README.rst

File metadata and controls

90 lines (59 loc) · 2.43 KB

cloudflare-python

THIS PROJECT IS STILL IN ITS PLANNING STAGE!

cloudflare-python provides a CLI and Python wrappers for CloudFlare's API.

Configuration

We need to create a configuration file the first time you use this.

$ cloudflare config

This asks you for the email address and API key associated with your CloudFlare account.

It then creates a file named .cloudflare.yaml in your home directory. The first line is your API key. The second line is the email address tied to your CloudFlare account.

We need this file, because CloudFlare's API wants the zone ID for most requests and it would be expensive to fetch it every time.

Usage

# General form:
$ cloudflare <noun> <verb> <noun_instance> args...

Usage: zones

According to CloudFlare's official API documentation, a zone is a domain name along with its subdomains and other identities.

# Add a site to your CloudFlare account:
$ cloudflare zone create example.com

# Show the basic info for a site tied to your CloudFlare account.
$ cloudflare zone show example.com

# List the sites tied to your CloudFlare account.
$ cloudflare zone list

Usage: DNS

# Show the DNS entries for a site
$ cloudflare dns show example.com

# Create a DNS entry for a site
$ cloudflare dns create subdomain.example.com 1.2.3.4 --type=A

# Update a DNS entry for a site
$ cloudflare dns update subdomain.example.com 1.2.3.4 --type=CNAME

Usage: cache

# Purge all files in a zone's cache
$ cloudflare cache purge example.com

# Purge a specific file in a zone's cache
$ cloudflare cache purge example.com --path=<url>