Replace token with seed and obtain token from seed + fix bug
Bug = getting data from dict
This commit is contained in:
parent
1b8c8793f0
commit
3e6d535a74
1 changed files with 11 additions and 4 deletions
|
@ -1,5 +1,6 @@
|
||||||
import urllib.request
|
import urllib.request
|
||||||
import json
|
import json
|
||||||
|
from pyotp import TOTP
|
||||||
|
|
||||||
UNGLEICH_PAY_SERVER_URL = "https://pay.ungleich.ch"
|
UNGLEICH_PAY_SERVER_URL = "https://pay.ungleich.ch"
|
||||||
|
|
||||||
|
@ -15,8 +16,12 @@ class ungleichPay(object):
|
||||||
self.parser['customers-list'].add_argument('--username', required=True)
|
self.parser['customers-list'].add_argument('--username', required=True)
|
||||||
self.parser['customers-list'].add_argument('--realm', required=True)
|
self.parser['customers-list'].add_argument('--realm', required=True)
|
||||||
self.parser['customers-list'].add_argument(
|
self.parser['customers-list'].add_argument(
|
||||||
'--token', required=True,
|
'--seed', required=True,
|
||||||
help="A valid token obtained from ungleich"
|
help="A valid seed obtained from ungleich"
|
||||||
|
)
|
||||||
|
self.parser['customers-list'].add_argument(
|
||||||
|
'--email', required=True,
|
||||||
|
help="Email associated with the username"
|
||||||
)
|
)
|
||||||
self.parser['customers-list'].add_argument(
|
self.parser['customers-list'].add_argument(
|
||||||
'--ungleich-pay-server', required=False,
|
'--ungleich-pay-server', required=False,
|
||||||
|
@ -30,14 +35,16 @@ class ungleichPay(object):
|
||||||
request_url = args.ungleich_pay_server + customers_list_endpoint
|
request_url = args.ungleich_pay_server + customers_list_endpoint
|
||||||
else:
|
else:
|
||||||
request_url = UNGLEICH_PAY_SERVER_URL + customers_list_endpoint
|
request_url = UNGLEICH_PAY_SERVER_URL + customers_list_endpoint
|
||||||
|
print(f"request_url={request_url}")
|
||||||
req = urllib.request.Request(url=request_url,
|
req = urllib.request.Request(url=request_url,
|
||||||
method='GET',
|
method='GET',
|
||||||
headers={
|
headers={
|
||||||
|
"email": args.email,
|
||||||
"username": args.username,
|
"username": args.username,
|
||||||
"realm": args.realm,
|
"realm": args.realm,
|
||||||
"token": args.token,
|
"token": TOTP(args.seed).now(),
|
||||||
"Accept": "application/json"
|
"Accept": "application/json"
|
||||||
})
|
})
|
||||||
response = urllib.request.urlopen(req)
|
response = urllib.request.urlopen(req)
|
||||||
response_json = json.loads(response.read().decode('utf-8'))
|
response_json = json.loads(response.read().decode('utf-8'))
|
||||||
print(response_json.data)
|
print(response_json["data"])
|
||||||
|
|
Loading…
Reference in a new issue