summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuval Adam <_@yuv.al>2020-09-21 23:29:10 +0300
committerYuval Adam <_@yuv.al>2020-09-21 23:29:10 +0300
commitd25708b978b50c905b062eb8ba3970e48ae276e8 (patch)
treecabb9f355cf557939147c32670d42f024aa816b8
parent3526314e0af5331ac25435d93ab225c37c6e62dc (diff)
Split server and prediction files
-rw-r--r--Pipfile2
-rw-r--r--Procfile2
-rw-r--r--iss/__init__.py0
-rw-r--r--iss/predictions.py (renamed from iss.py)10
-rw-r--r--iss/server.py8
5 files changed, 10 insertions, 12 deletions
diff --git a/Pipfile b/Pipfile
index 4495bbf..674b002 100644
--- a/Pipfile
+++ b/Pipfile
@@ -12,7 +12,7 @@ fastapi = "*"
uvicorn = "*"
[scripts]
-server = "uvicorn iss:app"
+server = "uvicorn iss.server:app"
[requires]
python_version = "3.8"
diff --git a/Procfile b/Procfile
index 61257a4..47d1b5d 100644
--- a/Procfile
+++ b/Procfile
@@ -1 +1 @@
-web: uvicorn iss:app --host=0.0.0.0 --port=${PORT}
+web: uvicorn iss.server:app --host=0.0.0.0 --port=${PORT}
diff --git a/iss/__init__.py b/iss/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/iss/__init__.py
diff --git a/iss.py b/iss/predictions.py
index 215b7c3..fa4aeff 100644
--- a/iss.py
+++ b/iss/predictions.py
@@ -1,4 +1,3 @@
-from fastapi import FastAPI
from skyfield.api import Topos, load
TEL_AVIV = Topos('32.0853 N', '34.7817 E')
@@ -22,12 +21,3 @@ def get_predictions(location=TEL_AVIV, satellite_name=ISS):
name = ('rise above 30°', 'culminate', 'set below 30°')[event]
print(ti)
print(ti.utc_strftime('%Y %b %d %H:%M:%S'), name)
-
-
-
-app = FastAPI()
-
-
-@app.get("/")
-async def root():
- return {"message": "Hello World"}
diff --git a/iss/server.py b/iss/server.py
new file mode 100644
index 0000000..ee60be1
--- /dev/null
+++ b/iss/server.py
@@ -0,0 +1,8 @@
+from fastapi import FastAPI
+
+app = FastAPI()
+
+
+@app.get("/")
+async def root():
+ return {"message": "Hello World"}