Initial commit

This commit is contained in:
Benjamyn 2018-11-08 09:44:23 +11:00
commit e39b2436bf
4 changed files with 27 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
env/
main.py
main2.py

BIN
.gotipy.py.swp Normal file

Binary file not shown.

24
gotipy.py Normal file
View File

@ -0,0 +1,24 @@
import requests
import json
class gotipy(object):
def __init__(self, token, url):
self.token = token
self.url = url
self.headers = {'X-Gotify-Key' : self.token}
def sendMessage(self, title, message):
self.title = title
self.message = message
self.requrl = self.url + '/message'
print(self.requrl)
#define a new dict for the message
data = {}
data["message"] = self.message
data["title"] = self.title
jdata = json.dumps(data)
print(jdata)
req = requests.post(self.requrl, headers=self.headers, json=data)
print(req.text)

BIN
gotipy.pyc Normal file

Binary file not shown.