Skip to content

Commit

Permalink
Merge branch 'master' of github.com:nbuchwitz/nc_dnsapi
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolai Buchwitz committed Aug 17, 2018
2 parents 873e98e + 16c6b6b commit 2ff893e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
A simple API wrapper for the netcup DNS API

```python
import nc_dnsapi
from nc_dnsapi import Client, DNSRecord

customer = 123456
api_key = "your-personal-api-key"
api_password = "your-private-api-password"

with nc_dnsapi.Client(customer, api_key, api_password) as api:
with Client(customer, api_key, api_password) as api:
# fetch records
records = api.dns_records("example.com")
print(records)
Expand Down
8 changes: 7 additions & 1 deletion nc_dnsapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ def __init__(self, hostname, type, destination, **kwargs):
raise TypeError("Invalid record type: {}".format(self.type))

def __str__(self):
return str(self.__dict__)
return '{}({})'.format(self.__class__.__name__, ', '.join(
'{}={!r}'.format(k, v)
for k, v in self.__dict__.items()
if v is not None
))

__repr__ = __str__

def __eq__(self, other):
if not isinstance(other, DNSRecord):
Expand Down

0 comments on commit 2ff893e

Please sign in to comment.