diff --git a/README.md b/README.md index e7f97e4..d934845 100644 --- a/README.md +++ b/README.md @@ -5,12 +5,13 @@ It is intended to be used by ungleich engineers and skilled customers. ## Requirements / Installation -* ensure you have python3 +* ensure you have **python3** and **pipenv** * git clone this repo * cd into this repo * run the following command ``` -sudo pip3 install -r requirements.txt +pipenv install +pipenv shell ``` ## Usage general diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 9d1c8a4..0000000 --- a/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -git+https://github.com/apixu/apixu-python.git@master#egg=apixu diff --git a/ungleich_dns.py b/ungleich_dns.py index 86b9dbe..85eb6bd 100644 --- a/ungleich_dns.py +++ b/ungleich_dns.py @@ -1,5 +1,7 @@ -import requests + +import urllib.request import argparse +import json class ungleichDNS(object): def __init__(self, parser, parents): @@ -20,14 +22,21 @@ class ungleichDNS(object): def _handle_dns(self, args): """Reverse dns endpoint.""" - r = requests.post( - 'https://dns.service.ungleich.ch', - json={ + url = 'https://dns.service.ungleich.ch' + req = urllib.request.Request( + url=url, + method='POST', + headers={ + "Content-Type": "application/json" + }, + data=json.dumps({ 'username': args.user, 'token': args.token, 'ipaddress': args.set_reverse, 'name': args.name, 'email': args.email, 'realm': args.realm - }) - print(r.text) + }).encode('utf-8') + ) + response = urllib.request.urlopen(req).read() + print(json.loads(response))