Skip to content

Instantly share code, notes, and snippets.

@Carlos-Augusto
Last active November 4, 2020 13:11
Show Gist options
  • Save Carlos-Augusto/89f2cb981924f2b2ad1b68db99a087af to your computer and use it in GitHub Desktop.
Save Carlos-Augusto/89f2cb981924f2b2ad1b68db99a087af to your computer and use it in GitHub Desktop.
import json
import requests
url = 'http://localhost:8080/send/CHANGEME'
data = {
"data": "hello",
"id": 1253,
"ts": 12349745884
}
pk = "CHANGE_ME"
pwd = "CHANGE_ME"
header = {
"content-type": "application/json",
"x-pk": pk,
"x-pass": pwd
}
payload = json.dumps(data, separators=(",", ":"), sort_keys=True) ## We format our data
resp = requests.post(url, data=payload, headers=header)
print(data)
print(payload) ## JSON for Verifications (DEV) -> {"data":"hello","id":1253,"ts":12349745884}
print(resp.text) ## {"status":200,"message":"Success","data":"e4GA3LHZ5a9tlU0O54gscvvFEnWnpnbmwhF3VJGnqqIimuJ9GlvZFwINobFxnwwLAJAUlG3ZJkiXZ5MUnrYqxA=="}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment