From bdb21e285a122d83c008e887c5817e281da197bb Mon Sep 17 00:00:00 2001 From: ahmedbilal Date: Fri, 7 Jun 2019 15:48:48 +0500 Subject: [PATCH 1/2] Now using Pipenv, requirements.txt removed --- Pipfile | 12 ++++++++++++ Pipfile.lock | 25 +++++++++++++++++++++++++ README.md | 2 +- requirements.txt | 1 - ungleich_dns.py | 21 +++++++++++++++------ 5 files changed, 53 insertions(+), 8 deletions(-) create mode 100644 Pipfile create mode 100644 Pipfile.lock delete mode 100644 requirements.txt diff --git a/Pipfile b/Pipfile new file mode 100644 index 0000000..2339605 --- /dev/null +++ b/Pipfile @@ -0,0 +1,12 @@ +[[source]] +name = "pypi" +url = "https://pypi.org/simple" +verify_ssl = true + +[dev-packages] + +[packages] +apixu-python = {git = "https://github.com/apixu/apixu-python.git"} + +[requires] +python_version = "3.7" diff --git a/Pipfile.lock b/Pipfile.lock new file mode 100644 index 0000000..d099c51 --- /dev/null +++ b/Pipfile.lock @@ -0,0 +1,25 @@ +{ + "_meta": { + "hash": { + "sha256": "e84e3c15d8fea5745b66f0970337d98fef35d6898635ea849162932e1dabd55a" + }, + "pipfile-spec": 6, + "requires": { + "python_version": "3.7" + }, + "sources": [ + { + "name": "pypi", + "url": "https://pypi.org/simple", + "verify_ssl": true + } + ] + }, + "default": { + "apixu-python": { + "git": "https://github.com/apixu/apixu-python.git", + "ref": "4beb003c71c0213720e930350f46e5fa6af9ef12" + } + }, + "develop": {} +} diff --git a/README.md b/README.md index 9a1594d..e16d057 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ It is intended to be used by ungleich engineers and skilled customers. * cd into this repo * run the following command ``` -sudo pip3 install -r requirements.txt +sudo pip3 install pipenv ``` ## Usage general diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 6404404..0000000 --- a/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -git+https://github.com/apixu/apixu-python.git@master 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)) From 56c341805be397e5f3be3b56fbdaad3d082f944b Mon Sep 17 00:00:00 2001 From: ahmedbilal Date: Fri, 7 Jun 2019 16:37:42 +0500 Subject: [PATCH 2/2] README.md updated --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e16d057..c945b68 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 pipenv +pipenv install +pipenv shell ``` ## Usage general