Spaces:
Sleeping
Sleeping
update
Browse files- proxyserver-fastapi.py +26 -0
proxyserver-fastapi.py
CHANGED
|
@@ -92,6 +92,7 @@ async def proxy_request(url_path: str, request: Request):
|
|
| 92 |
print(pretty_json)
|
| 93 |
|
| 94 |
|
|
|
|
| 95 |
# headers={}
|
| 96 |
# headers["accept"]="*/*"
|
| 97 |
# headers["accept-encoding"]="gzip, deflate, br"
|
|
@@ -109,6 +110,31 @@ async def proxy_request(url_path: str, request: Request):
|
|
| 109 |
# headers["x-request-id"]="YG7fx0"
|
| 110 |
|
| 111 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
print("\n\n请求头部-2: ")
|
| 113 |
pretty_json = json.dumps(headers, indent=4, sort_keys=True, ensure_ascii=False)
|
| 114 |
print(pretty_json)
|
|
|
|
| 92 |
print(pretty_json)
|
| 93 |
|
| 94 |
|
| 95 |
+
|
| 96 |
# headers={}
|
| 97 |
# headers["accept"]="*/*"
|
| 98 |
# headers["accept-encoding"]="gzip, deflate, br"
|
|
|
|
| 110 |
# headers["x-request-id"]="YG7fx0"
|
| 111 |
|
| 112 |
|
| 113 |
+
headers = {
|
| 114 |
+
"accept": "application/json",
|
| 115 |
+
"accept-encoding": "gzip,deflate",
|
| 116 |
+
"authorization": "Bearer AIzaSyDCbN6WDNIEtB8yJmNX40ScechQu6mCZoo",
|
| 117 |
+
"content-type": "application/json",
|
| 118 |
+
"user-agent": "Ds/JS 4.83.0",
|
| 119 |
+
"x-amzn-trace-id": "Root=1-68a06288-022c3dab58488992234ef2ea",
|
| 120 |
+
"x-direct-url": "https://airsltd-fastapi-proxy.hf.space/--replicas/zy7x5/v1/https/generativelanguage.googleapis.com/v1beta/openai/chat/completions",
|
| 121 |
+
"x-forwarded-for": "45.144.242.202",
|
| 122 |
+
"x-forwarded-port": "443",
|
| 123 |
+
"x-forwarded-proto": "https",
|
| 124 |
+
"x-ip-token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpcCI6IjQ1LjE0NC4yNDIuMjAyIiwidXNlciI6bnVsbCwidXVpZCI6bnVsbCwiZXJyb3IiOiJJbnZhbGlkQWNjZXNzVG9rZW4iLCJleHAiOjE3NTUzNDE1MDh9.CoTcnjFjlRZYiA7wJvfAJ0ktNYZb72b7iU327YYFALs",
|
| 125 |
+
"x-request-id": "6ErqXF",
|
| 126 |
+
"x-stainless-arch": "x64",
|
| 127 |
+
"x-stainless-lang": "js",
|
| 128 |
+
"x-stainless-os": "Linux",
|
| 129 |
+
"x-stainless-package-version": "4.83.0",
|
| 130 |
+
"x-stainless-retry-count": "0",
|
| 131 |
+
"x-stainless-runtime": "node",
|
| 132 |
+
"x-stainless-runtime-version": "v20.11.1",
|
| 133 |
+
"x-stainless-timeout": "600000"
|
| 134 |
+
}
|
| 135 |
+
|
| 136 |
+
|
| 137 |
+
|
| 138 |
print("\n\n请求头部-2: ")
|
| 139 |
pretty_json = json.dumps(headers, indent=4, sort_keys=True, ensure_ascii=False)
|
| 140 |
print(pretty_json)
|