Skip to content

Instantly share code, notes, and snippets.

@ronbeltran
Last active February 2, 2018 13:35
Show Gist options
  • Save ronbeltran/92510bf9b9e551b090b26a865c6980b4 to your computer and use it in GitHub Desktop.
Save ronbeltran/92510bf9b9e551b090b26a865c6980b4 to your computer and use it in GitHub Desktop.
import json
import requests
token = "your-api-token"
headers = {
"Content-Type": "application/json",
"Authorization": "Token {}".format(token)
}
payload = {
"useragent": "Mozilla/5.0 (iPad; CPU OS 5_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Mobile/9B176"
}
url = "https://useragentinfo.co/api/v1/device/"
r = requests.post(url, headers=headers, data=json.dumps(payload))
result = r.json()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment