Conor4250 / cloudflare-ddns

DDNS script to sync public IP address to CloudFlare dns records.

Home Page:https://pypi.python.org/pypi/cloudflare-ddns/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cloudflare-ddns

The Python DDNS(Dynamic DNS) script for CloudFlare. It can sync your public IP address to DNS records on CloudFlare. It also provide the RESTful API to operate CloudFlare API v4.

Installation

pip install cloudflare-ddns

Examples

  1. Sync your public ip address to dns record on CloudFlare

    • Use command in command line
    cloudflare-ddns email api_key domain
    • Print command line help
    cloudflare-ddns --help
    • Execute python package in command line
    python -m cloudflare_ddns email api_key domain --proxied
    • Python code
    from cloudflare_ddns import CloudFlare
    cf = CloudFlare(email, api_key, domain)
    cf.sync_dns_from_my_ip() # Successfully updated IP address from xx.xx.xx.xx to xx.xx.xx.xx
  2. RESTful dns record operation

cf.get_record('A', 'example.com')
cf.create_record('A', 'sub.example.com', '202.202.202.202')
cf.update_record('A', 'another.example.com', '202.202.202.202')
cf.delete_record('A', 'another.example.com')

Please note: The class will cache dns records information it gets from CloudFlare. To refresh cache, call 'refresh' method:

cf.refresh()

About

DDNS script to sync public IP address to CloudFlare dns records.

https://pypi.python.org/pypi/cloudflare-ddns/

License:MIT License


Languages

Language:Python 100.0%