Python

Python - httpclient

1
import http.client
2
3
conn = http.client.HTTPSConnection("pickyassist.com")
4
5
payload = "{\"token\":\"c2a0b6221c5dd55ceb09ae1f74e46521756d\",\"priority \":0,\"application\":\"2\",\"sleep\":0,\"globalmessage\":\"\",\"globalmedia\":\"\",\"data\":[{\"number\":\"1212\",\"message\":\"Test\"}]}"
6
7
headers = {
8
'content-type': "application/json"
9
}
10
11
conn.request("POST", "/app/api/v2/push", payload, headers)
12
13
res = conn.getresponse()
14
data = res.read()
15
16
print(data.decode("utf-8"))
Copied!

Python - Request

1
import requests
2
3
url = "https://pickyassist.com/app/api/v2/push"
4
5
payload = "{\"token\":\"c2a0b6221c5dd55ceb09ae1f74e46521756d\",\"priority \":0,\"application\":\"2\",\"sleep\":0,\"globalmessage\":\"\",\"globalmedia\":\"\",\"data\":[{\"number\":\"1212\",\"message\":\"Test\"}]}"
6
headers = {
7
'content-type': "application/json"
8
}
9
10
response = requests.request("POST", url, data=payload, headers=headers)
11
12
print(response.text)
Copied!
Last modified 2yr ago