Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -52,15 +52,17 @@ async def proxy_request(request: Request):
|
|
| 52 |
# Capture all query parameters from the incoming request
|
| 53 |
query_params = request.query_params
|
| 54 |
|
| 55 |
-
# Encode the parameters for the new URL
|
| 56 |
-
encoded_params = urlencode(query_params)
|
| 57 |
-
|
| 58 |
-
# Construct the full URL for the private space endpoint
|
| 59 |
-
private_api_url = f"{api_url}/eins/?{encoded_params}"
|
| 60 |
-
|
| 61 |
# check access token match
|
| 62 |
if 'key' in query_params and query_params['key'] == use_token:
|
| 63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
try:
|
| 65 |
print('params', private_api_url)
|
| 66 |
async with httpx.AsyncClient(timeout=60.0) as client:
|
|
|
|
| 52 |
# Capture all query parameters from the incoming request
|
| 53 |
query_params = request.query_params
|
| 54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
# check access token match
|
| 56 |
if 'key' in query_params and query_params['key'] == use_token:
|
| 57 |
+
|
| 58 |
+
# private API doesn't handle token
|
| 59 |
+
query_params.pop('key')
|
| 60 |
+
# Encode the parameters for the new URL
|
| 61 |
+
encoded_params = urlencode(query_params)
|
| 62 |
+
# Construct the full URL for the private space endpoint
|
| 63 |
+
private_api_url = f"{api_url}/eins/?{encoded_params}"
|
| 64 |
+
|
| 65 |
+
# Use httpx to make an asynchronous GET request to the private API
|
| 66 |
try:
|
| 67 |
print('params', private_api_url)
|
| 68 |
async with httpx.AsyncClient(timeout=60.0) as client:
|