Page 1 of 1

Help with Python Payload

Posted: 21. Jun 2023, 02:15
by proufo
Hello all.

I need a simple Python API payload that will send a message and no more. Tried some ways to adapt the one in the documentation but it beat me.

As it is now, the PS notifications expect a reply and the they get resent. Lots of drama.

Many thanks in advance.

Re: Help with Python Payload

Posted: 21. Jun 2023, 12:37
by admin
use this one, change the parameter in brackets.

Code: Select all

from urllib.parse import urlencode
from urllib.request import Request, urlopen

url = 'https://www.pushsafer.com/api'
post_fields = {
	"t" : 'Test',
	"m" : 'Test Message',
	"s" : 11,
	"v" : 3,
	"i" : 33,
	"c" : '#FF0000',
	"d" : '[device_id]',
	"u" : 'https://www.pushsafer.com',
	"ut" : 'Open Pushsafer',
	"k" : '[private_key]',
	}

request = Request(url, urlencode(post_fields).encode())
json = urlopen(request).read().decode()
print(json)

Re: Help with Python Payload

Posted: 21. Jun 2023, 14:28
by proufo
Perfect.

Many, many thanks!