Initial commit
This commit is contained in:
commit
e39b2436bf
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
env/
|
||||||
|
main.py
|
||||||
|
main2.py
|
||||||
BIN
.gotipy.py.swp
Normal file
BIN
.gotipy.py.swp
Normal file
Binary file not shown.
24
gotipy.py
Normal file
24
gotipy.py
Normal 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
BIN
gotipy.pyc
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user