add script to generate lat & lon

This commit is contained in:
nilo 2020-11-14 16:11:45 +01:00
parent 9605a20e22
commit d9828405ba
5 changed files with 37 additions and 1 deletions

6
.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
bin/
lib/
lib64
pyvenv.cfg
share/
status.json

13
generate.py Normal file
View File

@ -0,0 +1,13 @@
import requests
with open('status.json.in') as st_in:
content = st_in.read()
obj = requests.get("http://api.open-notify.org/iss-now.json").json()
lat = obj['iss_position']['latitude']
lon = obj['iss_position']['longitude']
with open('status.json', 'w') as st_out:
st_out.write(content % (lat, lon))

1
requirements.txt Normal file
View File

@ -0,0 +1 @@
requests

View File

@ -1 +0,0 @@
{"space": "ChaosZone", "url": "https://chaoszone.cz", "issue_report_channels": ["email"], "contact": {"email": "chaoszone@eigenbaukombinat.de"}, "state": {"open": false, "icon": {"open": "", "closed": ""}}, "api": "0.13", "location": {"lat": 0, "lon": 0, "address": "Eastside"}, "logo": "https://cfp.chaoszone.cz/media/csr20/img/chaoszone.png", "feeds": {"calendar": {"url": "https://raw.githubusercontent.com/chaosz0ne/spaceapi/master/chaoszone.ics", "type": "ical"}}}

17
status.json.in Normal file
View File

@ -0,0 +1,17 @@
{
"space": "ChaosZone",
"url": "https://chaoszone.cz",
"issue_report_channels": ["email"],
"contact": {
"email": "chaoszone@eigenbaukombinat.de"},
"state": {
"open": false, "icon": {"open": "", "closed": ""}},
"api": "0.13",
"location": {
"lat": %s, "lon": %s, "address": "Eastside"},
"logo": "https://cfp.chaoszone.cz/media/csr20/img/chaoszone.png",
"feeds": {
"calendar": {
"url": "https://raw.githubusercontent.com/chaosz0ne/spaceapi/master/chaoszone.ics",
"type": "ical"}}
}