Last active
November 4, 2020 13:11
-
-
Save Carlos-Augusto/89f2cb981924f2b2ad1b68db99a087af to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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