Spaces:
Sleeping
Sleeping
github-actions[bot]
commited on
Commit
·
9779927
1
Parent(s):
fbac67c
Update from GitHub Actions
Browse files
main.py
CHANGED
@@ -69,6 +69,8 @@ async def proxy(request: Request, path: str, target_url: Optional[str] = None):
|
|
69 |
response = scraper.get('https://httpbin.org/ip')
|
70 |
print(response.text)
|
71 |
|
|
|
|
|
72 |
# 获取请求体
|
73 |
body = await request.body()
|
74 |
|
@@ -78,11 +80,11 @@ async def proxy(request: Request, path: str, target_url: Optional[str] = None):
|
|
78 |
params.pop("url", None)
|
79 |
params.pop("stream", None)
|
80 |
|
|
|
81 |
# 获取原始请求头
|
82 |
headers = dict(request.headers)
|
83 |
# 移除可能导致问题的头
|
84 |
headers.pop("host", None)
|
85 |
-
headers.pop("content-length", None)
|
86 |
headers.pop("cookie", None)
|
87 |
headers.pop("x-forwarded-for", None)
|
88 |
headers.pop("x-forwarded-proto", None)
|
@@ -92,11 +94,12 @@ async def proxy(request: Request, path: str, target_url: Optional[str] = None):
|
|
92 |
headers.pop("x-ip-token", None)
|
93 |
headers.pop("x-direct-url", None)
|
94 |
headers.pop("x-direct-url", None)
|
95 |
-
headers.pop("content-type", None)
|
96 |
headers.pop("accept", None)
|
97 |
headers.pop("accept-language", None)
|
98 |
-
headers.pop("user-agent", None)
|
99 |
headers.pop("accept-encoding", None)
|
|
|
|
|
|
|
100 |
print(f"{headers}")
|
101 |
# 构建请求参数
|
102 |
request_kwargs = {
|
|
|
69 |
response = scraper.get('https://httpbin.org/ip')
|
70 |
print(response.text)
|
71 |
|
72 |
+
|
73 |
+
|
74 |
# 获取请求体
|
75 |
body = await request.body()
|
76 |
|
|
|
80 |
params.pop("url", None)
|
81 |
params.pop("stream", None)
|
82 |
|
83 |
+
|
84 |
# 获取原始请求头
|
85 |
headers = dict(request.headers)
|
86 |
# 移除可能导致问题的头
|
87 |
headers.pop("host", None)
|
|
|
88 |
headers.pop("cookie", None)
|
89 |
headers.pop("x-forwarded-for", None)
|
90 |
headers.pop("x-forwarded-proto", None)
|
|
|
94 |
headers.pop("x-ip-token", None)
|
95 |
headers.pop("x-direct-url", None)
|
96 |
headers.pop("x-direct-url", None)
|
|
|
97 |
headers.pop("accept", None)
|
98 |
headers.pop("accept-language", None)
|
|
|
99 |
headers.pop("accept-encoding", None)
|
100 |
+
headers.pop("content-type", None)
|
101 |
+
headers.pop("content-length", None)
|
102 |
+
headers.pop("user-agent", None)
|
103 |
print(f"{headers}")
|
104 |
# 构建请求参数
|
105 |
request_kwargs = {
|