Now using Pipenv, requirements.txt removed

This commit is contained in:
ahmadbilalkhalid 2019-06-07 15:48:48 +05:00
parent b8794b900b
commit bdb21e285a
5 changed files with 53 additions and 8 deletions

12
Pipfile Normal file
View file

@ -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"

25
Pipfile.lock generated Normal file
View file

@ -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": {}
}

View file

@ -10,7 +10,7 @@ It is intended to be used by ungleich engineers and skilled customers.
* cd into this repo * cd into this repo
* run the following command * run the following command
``` ```
sudo pip3 install -r requirements.txt sudo pip3 install pipenv
``` ```
## Usage general ## Usage general

View file

@ -1 +0,0 @@
git+https://github.com/apixu/apixu-python.git@master

View file

@ -1,5 +1,7 @@
import requests
import urllib.request
import argparse import argparse
import json
class ungleichDNS(object): class ungleichDNS(object):
def __init__(self, parser, parents): def __init__(self, parser, parents):
@ -20,14 +22,21 @@ class ungleichDNS(object):
def _handle_dns(self, args): def _handle_dns(self, args):
"""Reverse dns endpoint.""" """Reverse dns endpoint."""
r = requests.post( url = 'https://dns.service.ungleich.ch'
'https://dns.service.ungleich.ch', req = urllib.request.Request(
json={ url=url,
method='POST',
headers={
"Content-Type": "application/json"
},
data=json.dumps({
'username': args.user, 'username': args.user,
'token': args.token, 'token': args.token,
'ipaddress': args.set_reverse, 'ipaddress': args.set_reverse,
'name': args.name, 'name': args.name,
'email': args.email, 'email': args.email,
'realm': args.realm 'realm': args.realm
}) }).encode('utf-8')
print(r.text) )
response = urllib.request.urlopen(req).read()
print(json.loads(response))