21 lines
673 B
Python
21 lines
673 B
Python
import sys
|
|
import urllib.request
|
|
import json
|
|
|
|
sys.stdout.reconfigure(encoding='utf-8')
|
|
|
|
def main():
|
|
req = urllib.request.Request('http://140.44.4.70:8090/message', headers={'X-Gotify-Key': 'C1dIsCoRdBrIdGeClIeN'})
|
|
try:
|
|
with urllib.request.urlopen(req, timeout=5) as resp:
|
|
data = json.loads(resp.read().decode())
|
|
messages = data.get('messages', [])
|
|
print(f"TOTAL MESSAGES IN GOTIFY: {len(messages)}")
|
|
for m in messages[:8]:
|
|
print(f"- [App {m.get('appid')}] {m.get('title')}: {m.get('message')[:80]}")
|
|
except Exception as e:
|
|
print("Error:", e)
|
|
|
|
if __name__ == '__main__':
|
|
main()
|