https://github.com/peakwinter/python-rage4dns
Python bindings for RAGE4 DNS API
https://github.com/peakwinter/python-rage4dns
Last synced: 7 months ago
JSON representation
Python bindings for RAGE4 DNS API
- Host: GitHub
- URL: https://github.com/peakwinter/python-rage4dns
- Owner: peakwinter
- License: gpl-3.0
- Created: 2015-05-21T20:29:37.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2016-04-27T04:22:23.000Z (about 10 years ago)
- Last Synced: 2024-12-29T15:28:13.738Z (over 1 year ago)
- Language: Python
- Size: 17.6 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# python-rage4dns
Python bindings for RAGE4 DNS API
## How to Use
First, set your account email and API key as follows:
```
>>> import rage4
>>> rage4.USERNAME = "myname@mydomain.xyz"
>>> rage4.ACCT_KEY = "theAPIstringwouldgohere"
```
#### Get domain(s)
- Get all domains: `rage4.get_domains()`
- Get domain by ID (ex. ID 1): `rage4.get_domain(1)`
- Get domain by name: `rage4.get_domain(name="mydomain.xyz")`
#### Add domain
Optional params for `add()` are NS1 and NS2. If not specified then the RAGE4 names will be used.
```
>>> domain = rage4.Domain("mydomain.xyz", "myname@mydomain.xyz")
>>> domain.add()
```
#### Delete domain
```
>>> domain = rage4.get_domain(name="mydomain.xyz")
>>> domain.delete()
```
#### Get DNS records for a domain
```
>>> domain = rage4.get_domain(name="mydomain.xyz")
>>> records = domain.get_records()
```
#### Add a DNS record to a domain
Params for the object: Name, content, record type, TTL and priority.
Optional params: `failover_enabled` and `failover_content`
Optional params for `add()`: `geo` and `active`. `geo` can either be a geocode (obtained from `rage4.get_geo_regions()`) or a tuple of latitude and longitude. Active defaults to `True`.
```
>>> domain = rage4.get_domain(name="mydomain.xyz")
>>> record = rage4.Record("www.mydomain.xyz", "127.0.0.1", rage4.RECORD_TYPES["A"],
... 3600, 1)
>>> domain.add_record(record)
```