Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import requests
- def findLogs(userid):
- """
- return the last log element for a given userid
- params:
- userid - the userid
- returnvalues:
- $str - the logid
- 2 - error during the process
- """
- if len(str(userid)) == 17:
- url = 'http://logs.tf/json_search?player={}'.format(userid)
- req = requests.get(url)
- response = req.text
- if response.find('502 Bad Gateway') == -1:
- data=json.loads(response)
- try:
- lastlogs = data['logs'][0]['id']
- return str(lastlogs)
- except:
- return 2
- else:
- return 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement