|
@@ -20,7 +20,7 @@ def _get_api_key():
|
|
|
|
|
|
|
|
def _get_url(this_id):
|
|
def _get_url(this_id):
|
|
|
torn_api_key = _get_api_key()
|
|
torn_api_key = _get_api_key()
|
|
|
- url = f"https://api.torn.com/user/{this_id}?selections=basic&key="
|
|
|
|
|
|
|
+ url = f"https://api.torn.com/user/{this_id}?selections=basic,timestamp&key="
|
|
|
url = url+torn_api_key
|
|
url = url+torn_api_key
|
|
|
return url
|
|
return url
|
|
|
|
|
|
|
@@ -43,7 +43,7 @@ def _get_status(this_id):
|
|
|
# pprint(this_status)
|
|
# pprint(this_status)
|
|
|
status_return = None
|
|
status_return = None
|
|
|
if this_status:
|
|
if this_status:
|
|
|
- status_return = this_status['status'], this_status['name']
|
|
|
|
|
|
|
+ status_return = this_status['status'], this_status['name'], this_status['timestamp']
|
|
|
return status_return
|
|
return status_return
|
|
|
|
|
|
|
|
|
|
|
|
@@ -68,12 +68,12 @@ def _from_roman_to_integer(roman_number):
|
|
|
|
|
|
|
|
def get_loot_level(this_id):
|
|
def get_loot_level(this_id):
|
|
|
this_loot_level = 0
|
|
this_loot_level = 0
|
|
|
- this_status_status, this_status_name = _get_status(this_id)
|
|
|
|
|
|
|
+ this_status_status, this_status_name, this_status_timestamp = _get_status(this_id)
|
|
|
if this_status_status and len(this_status_status) > 1:
|
|
if this_status_status and len(this_status_status) > 1:
|
|
|
if this_status_status[0] == 'Okay' and 'Loot level' in this_status_status[1]:
|
|
if this_status_status[0] == 'Okay' and 'Loot level' in this_status_status[1]:
|
|
|
this_loot_level = this_status_status[1][11:].strip()
|
|
this_loot_level = this_status_status[1][11:].strip()
|
|
|
# print(this_loot_level)
|
|
# print(this_loot_level)
|
|
|
this_integer = _from_roman_to_integer(this_loot_level)
|
|
this_integer = _from_roman_to_integer(this_loot_level)
|
|
|
this_status_dict = {"id": this_id, "name": this_status_name, "integer": this_integer, "roman": this_loot_level,
|
|
this_status_dict = {"id": this_id, "name": this_status_name, "integer": this_integer, "roman": this_loot_level,
|
|
|
- "text": this_status_status}
|
|
|
|
|
|
|
+ "text": this_status_status, "timestamp": this_status_timestamp}
|
|
|
return this_status_dict
|
|
return this_status_dict
|