Skip to content

Commit

Permalink
Merge pull request #270 from scimma/djones-tns-api
Browse files Browse the repository at this point in the history
small changes to adjust to new TNS API format
  • Loading branch information
djones1040 authored Dec 31, 2024
2 parents 346e8c1 + 588da71 commit 5338d4d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app/host/transient_name_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ def query_tns(data, headers, search_url):
"""

response = requests.post(search_url, headers=headers, data=data)
response = json.loads(response.text)
response_json = json.loads(response.text)

response_message = response.get("id_message")
response_id_code = response.get("id_code")
response_message = response_json.get("id_message")
response_id_code = response_json.get("id_code")

response_status_good = response_id_code == 200
data = response.get("data", {}).get("reply") if response_status_good else []
response_reset_time = response.get("data", {}).get("total", {}).get("reset")
data = response_json.get("data", {}) if response_status_good else []
response_reset_time = response.headers['x-rate-limit-reset']

response_return = {
"response_message": response_message,
Expand Down

0 comments on commit 5338d4d

Please sign in to comment.