Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,7 +4,10 @@ import httpx
|
|
| 4 |
from urllib.parse import urlencode
|
| 5 |
import uvicorn
|
| 6 |
|
| 7 |
-
app = FastAPI(
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
# Access the secret environment variable
|
| 10 |
private_space_token = os.environ.get('api_key')
|
|
@@ -28,11 +31,11 @@ async def proxy_request(request: Request):
|
|
| 28 |
encoded_params = urlencode(query_params)
|
| 29 |
|
| 30 |
# Construct the full URL for the private space endpoint
|
| 31 |
-
private_api_url = f"{api_url}/?{encoded_params}"
|
| 32 |
|
| 33 |
# Use httpx to make an asynchronous GET request to the private API
|
| 34 |
try:
|
| 35 |
-
print('params', encoded_params)
|
| 36 |
async with httpx.AsyncClient(timeout=60.0) as client:
|
| 37 |
response = await client.get(private_api_url, headers=headers)
|
| 38 |
response.raise_for_status() # Raise an exception for 4xx/5xx responses
|
|
|
|
| 4 |
from urllib.parse import urlencode
|
| 5 |
import uvicorn
|
| 6 |
|
| 7 |
+
app = FastAPI(
|
| 8 |
+
docs_url=None,
|
| 9 |
+
redoc_url=None
|
| 10 |
+
)
|
| 11 |
|
| 12 |
# Access the secret environment variable
|
| 13 |
private_space_token = os.environ.get('api_key')
|
|
|
|
| 31 |
encoded_params = urlencode(query_params)
|
| 32 |
|
| 33 |
# Construct the full URL for the private space endpoint
|
| 34 |
+
private_api_url = f"{api_url}/eins?{encoded_params}"
|
| 35 |
|
| 36 |
# Use httpx to make an asynchronous GET request to the private API
|
| 37 |
try:
|
| 38 |
+
print('params', private_api_url, encoded_params)
|
| 39 |
async with httpx.AsyncClient(timeout=60.0) as client:
|
| 40 |
response = await client.get(private_api_url, headers=headers)
|
| 41 |
response.raise_for_status() # Raise an exception for 4xx/5xx responses
|