/env to see environment
Browse files- fetch.py +7 -2
- pyproject.toml +1 -1
fetch.py
CHANGED
@@ -4,7 +4,7 @@ from contextlib import asynccontextmanager
|
|
4 |
from datetime import datetime
|
5 |
from fastapi import FastAPI, Request
|
6 |
from fastapi.responses import FileResponse, PlainTextResponse, Response
|
7 |
-
from os import getenv
|
8 |
from pathlib import Path
|
9 |
from typing import Any
|
10 |
|
@@ -120,6 +120,11 @@ def query_analytics():
|
|
120 |
return LOGFILE.as_posix()
|
121 |
|
122 |
|
|
|
|
|
|
|
|
|
|
|
123 |
@app.get("/favicon.ico")
|
124 |
async def favicon():
|
125 |
return {"message": "woof!"}
|
@@ -133,7 +138,7 @@ async def ping():
|
|
133 |
def self_ping():
|
134 |
self_host = getenv("SPACE_HOST", "0.0.0.0:7860")
|
135 |
with httpx.Client() as client:
|
136 |
-
_ = client.get(f"http://{self_host}/ping")
|
137 |
|
138 |
|
139 |
scheduler = AsyncIOScheduler(executors={"default": AsyncIOExecutor()})
|
|
|
4 |
from datetime import datetime
|
5 |
from fastapi import FastAPI, Request
|
6 |
from fastapi.responses import FileResponse, PlainTextResponse, Response
|
7 |
+
from os import environ, getenv
|
8 |
from pathlib import Path
|
9 |
from typing import Any
|
10 |
|
|
|
120 |
return LOGFILE.as_posix()
|
121 |
|
122 |
|
123 |
+
@app.api_route("/env", response_class=PrettyJSONResponse)
|
124 |
+
def show_env():
|
125 |
+
return environ
|
126 |
+
|
127 |
+
|
128 |
@app.get("/favicon.ico")
|
129 |
async def favicon():
|
130 |
return {"message": "woof!"}
|
|
|
138 |
def self_ping():
|
139 |
self_host = getenv("SPACE_HOST", "0.0.0.0:7860")
|
140 |
with httpx.Client() as client:
|
141 |
+
_ = client.get(f"http://{self_host}/ping", follow_redirects=True)
|
142 |
|
143 |
|
144 |
scheduler = AsyncIOScheduler(executors={"default": AsyncIOExecutor()})
|
pyproject.toml
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
[project]
|
2 |
name = "fetch"
|
3 |
-
version = "0.3.
|
4 |
description = "Puppy Installer"
|
5 |
authors = [
|
6 |
{ name = "Alex Kislukhin" }
|
|
|
1 |
[project]
|
2 |
name = "fetch"
|
3 |
+
version = "0.3.5"
|
4 |
description = "Puppy Installer"
|
5 |
authors = [
|
6 |
{ name = "Alex Kislukhin" }
|