Skip to content

Instantly share code, notes, and snippets.

@Nocube
Forked from JagCesar/pushMe.sh
Last active March 29, 2020 21:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Nocube/0b63a165f9267b721924d58a81b006f6 to your computer and use it in GitHub Desktop.
Save Nocube/0b63a165f9267b721924d58a81b006f6 to your computer and use it in GitHub Desktop.
Push Me Python script
#! /usr/bin/python
import requests
# Send Message to Push Me App via HTTP POST Request.
# This mimics the Curl headers.
def PostAlert(secret_tok, msg):
url = 'https://pushmeapi.jagcesar.se'
data='title=' + msg + '&token=' + secret_tok
headers = {'Host': 'pushmeapi.jagcesar.se', 'User-Agent': 'curl/7.55.1', 'Accept': '*/*', \
'Content-Length': str(len(data)), 'content-type': 'application/x-www-form-urlencoded'}
r = requests.post(url, data, headers=headers)
#print(r.text)
# Get the Secret Token from the Push Me App, look in Inboxes -> Share Identifier and set it here.
pushme_secret_tok = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
# Send Test Message
pushme_msg = 'This text will go to Push Me App.'
PostAlert(pushme_secret_tok, pushme_msg)
@Nocube
Copy link
Author

Nocube commented Jan 23, 2020

Python version of the Push Me script.

@Nocube
Copy link
Author

Nocube commented Jan 23, 2020

Just in case anyone needs to run this on Windows 10, here is a command shell example using curl:

C:\Windows\System32\curl.exe -o NUL -s -d "title=Text Message&token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" -X POST https://pushmeapi.jagcesar.se

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment