Skip to content

Commit 1774a7e

Browse files
committed
added functions for ptr records
1 parent b62d144 commit 1774a7e

1 file changed

Lines changed: 81 additions & 0 deletions

File tree

vscale.py

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -878,3 +878,84 @@ def delete_domain_tag(token, tagid):
878878
"application/json;charset=UTF-8",
879879
"X-Token": token}
880880
)
881+
882+
883+
"""
884+
Function create_ptr_record performs a POST-request at
885+
https://api.vscale.io/v1/domains/ptr/, creates a new PTR record.
886+
Token has to be provided as a str object.
887+
ip has to be provided as a str object.
888+
Domain has to be provided as a str object.
889+
"""
890+
891+
892+
def create_ptr_record(token, ip, domain):
893+
return requests.post("https://api.vscale.io/v1/domains/ptr/",
894+
headers={"Content-Type":
895+
"application/json;charset=UTF-8",
896+
"X-Token": token},
897+
data=json.loads({"ip": ip, "content": domain})
898+
)
899+
900+
901+
"""
902+
Function list_ptr_records performs a GET-record at
903+
https://api.vscale.io/v1/domains/ptr/, returns a list of all PTR records.
904+
Token has to be provided as a str object.
905+
"""
906+
907+
def list_ptr_records(token):
908+
return requests.get("https://api.vscale.io/v1/domains/ptr/",
909+
headers={"X-Token": token}
910+
)
911+
912+
913+
"""
914+
Function get_ptr_record performs a GET-record at
915+
https://api.vscale.io/v1/domains/ptr/, gets information on a
916+
PTR record with a given ptr id.
917+
Token has to be provided as a str object.
918+
PTR id has to be provided as a str object.
919+
"""
920+
921+
922+
def get_ptr_record(token, ptrid):
923+
return requests.get("https://api.vscale.io/v1/domains/ptr/"+str(ptrid),
924+
headers={"X-Token": token}
925+
)
926+
927+
928+
"""
929+
Function update_ptr_record performs a PUT-request at
930+
https://api.vscale.io/v1/domains/ptr/, updates PTR record.
931+
Token has to be provided as a str object.
932+
PTR id has to be provided as a str object.
933+
ip has to be provided as a str object.
934+
Domain has to be provided as a str object.
935+
"""
936+
937+
938+
def update_ptr_record(token, ptrid, ip, domain):
939+
return requests.put("https://api.vscale.io/v1/domains/ptr/"+str(ptrid),
940+
headers={"Content-Type":
941+
"application/json;charset=UTF-8",
942+
"X-Token": token},
943+
data=json.loads({"ip": ip, "content": domain})
944+
)
945+
946+
947+
"""
948+
Function delete_ptr_record performs a DELETE-record at
949+
https://api.vscale.io/v1/domains/ptr/, deletes a PTR record with a
950+
given PTR id.
951+
Token has to be provided as a str object.
952+
PTR id has to be provided as a str object.
953+
"""
954+
955+
956+
def delete_ptr_record(token, ptrid):
957+
return requests.delete("https://api.vscale.io/v1/domains/ptr/"+str(ptrid),
958+
headers={"Content-Type":
959+
"application/json;charset=UTF-8",
960+
"X-Token": token},
961+
)

0 commit comments

Comments
 (0)