Skrivet av swesen:
Hur ser din python kod ut nu? Så kanske vi kan hitta vad som inte funkar.
Jag är rätt säker på att det inte är något större fel på anropen, för vissa ger svar som väntat. Här är anrop och svar:
import requests
auth=('xxx@gmail.com', 'xxx')
payload = {
'username': "xxx@gmail.com",
'password': "xxx"
}
req = requests.post('https://min.hostup.se/api/login', json=payload)
print(req.json())
headers = {
'Authorization': 'Bearer ' + req.json()["token"]
}
#https://min.hostup.se/userapi#domain-details-33
req = requests.get('https://min.hostup.se/api/domain', headers=headers)
print(req.json())
#https://min.hostup.se/userapi#domain-details-34
req = requests.get('https://min.hostup.se/api/domain/xxx', headers=headers)
print(req.json())
#https://min.hostup.se/userapi#dns-records-types-43
req = requests.get('https://min.hostup.se/api/domain/xxx/dns/types', headers=headers)
print(req.json())
payload = {
'name': "xxx",
'type': "A",
'priority': "0",
'content': "xxx.xxx.xxx.xxx",
}
#https://min.hostup.se/userapi#create-dns-records-40
req = requests.post('https://min.hostup.se/api/domain/xxx/dns', json=payload, headers=headers)
print(req.json())
$ python tester.py
{u'token': u'eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvbWluLmhvc3R1cC5zZVwvYXBpXC8iLCJhdWQiOiJqby5oZW5uaW5nQGdtYWlsLmNvbSIsInN1YiI6IjI0MzIyNDYzNmU0ZTQ5NTUyYjQ5NzgzMjYyNjg0YjRlNjU0ZDQ5NmMzMTRhNjc2NDM3NDc0MTZmMzM2YTUxNDI0MzQ5NjE0YTUzNmQ2ODc3NGE3ODM2NTMzNjUxNTU2NDMxNzk3MDY5Mzc2MzRkMzU0NDZhNTg2OTc0NzU2OTZlNzY2NzZlNzI3NDRiNDgzODY1N2EzMjc1NTg2ODZlNWEzNTRlNzM1NzM4NjQ2NTc0NDk2Yzc1NWE0YTQzNDE2NzU2NzU2YzcwNzY1MjM1NDc1MDYxNmY2NzUzMzc3MDY0NjczZDNkIiwiaXAiOiI4OS4xNjAuMzcuNzciLCJp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p-20WXa7aeVuwyeDkiRSsfyNRay_8FaM7b_N2_tIVqPYa-M4vfFF4W_avMiJkoe7sPQXOrpC2MZKcaVGj59CberR_vwMekXymMy-9KCWhG02wDbC8P-bOJMzVLtonHd1IY0iqo4dYtsCcr9zo2z9AVqBuyl8PbhEkLEihYegNKrboCNr_adxyFFyC4ZcY93mYl2WLWAx-9p06QAcR8F-6GXp3VjxBVQ0haDhEk2oYh17HjlikBsdSJtD-WOe4VuZsh2FIKTs0SfVxufvmw-P1h3TKw-gxsAbxf3Z2uJj7_1HERYrxK485nGehNXIH-TnmJIdmXf6wus_UkO0UwKdbKnGuaEzvl3WvxCUMiCT6OYFg62MFolsW50ZcAfeNQzOPb3SP2WxC2WyrrJqwthm-ynxAJ7meHERmWkKX7d-xAzWN-Q6JLK5s1Vt6MSlfXJ1fNbQfRkcaNk3kl4DUytSQCZTsmlZS2MxCWifogNBTPFUpyCrkLD7Yqxxx'}
{u'domains': [{u'status': u'Active', u'recurring_amount': u'125.00', u'name': u'xxx', u'idprotection': u'0', u'expires': u'2023-04-26', u'period': u'1', u'autorenew': u'1', u'daytoexpire': u'45', u'date_created': u'2023-03-12', u'id': u'xxx'}, {u'status': u'Active', u'recurring_amount': u'125.00', u'name': u'xxx', u'idprotection': u'0', u'expires': u'2023-04-12', u'period': u'1', u'autorenew': u'1', u'daytoexpire': u'31', u'date_created': u'2023-03-12', u'id': u'xxx'}, {u'status': u'Active', u'recurring_amount': u'125.00', u'name': u'xxx', u'idprotection': u'0', u'expires': u'2023-10-24', u'period': u'1', u'autorenew': u'1', u'daytoexpire': u'226', u'date_created': u'2022-10-24', u'id': u'xxx'}], u'success': True}
{u'details': {u'status': u'Active', u'next_due': u'2023-10-24', u'recurring_amount': u'125.00', u'name': u'xxx', u'contacts': [], u'nameservers': [u'ns1.hostup.se', u'ns2.hostup.se', u'ns3.hostup.se', u'ns4.hostup.se', u''], u'idprotection': u'0', u'expires': u'2023-10-24', u'period': u'1', u'next_invoice': u'2023-09-24', u'autorenew': u'1', u'firstpayment': u'110.00', u'date_created': u'2022-10-24', u'id': u'xxx'}, u'success': True}
{u'types': None, u'success': True}
[]
Fingerat med en del xxx.