JoeanAmier/XHS-Downloader

请问服务器的api模式支持国外服务器访问吗?

arthurfsy2 opened this issue · 1 comments

1、API服务是由国内的群辉使用docker部署的: joeanamier/xhs-downloader:2.2-Beta
2、在PC本地发起post请求IP:PORT/xhs/可以正常获取数据
3、但是github action通过post无法获取数据。
我尝试加上proxy参数,但是还是会报错(是否是因为代理是国内代理到国外,所以也不行?)

def api_demo(server_address, link, proxy):
    server = f"{server_address}/xhs/"
    data = {
        "url": link,
        "proxy":proxy
    }
    response = requests.post(server, json=data)
    # 其他代码

以下是加了proxy后的错误提示(完整github action

response = requests.post(server, json=data)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.5/x[64](https://github.com/arthurfsy2/XHS2Blog/actions/runs/10503181706/job/29096045736#step:5:65)/lib/python3.12/site-packages/requests/api.py", line 115, in post
    return request("post", url, data=data, json=json, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.5/x64/lib/python3.12/site-packages/requests/api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.5/x64/lib/python3.12/site-packages/requests/sessions.py", line 589, in request
    resp = self.send(prep, **send_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.5/x64/lib/python3.12/site-packages/requests/sessions.py", line 703, in send
    r = adapter.send(request, **kwargs)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/hostedtoolcache/Python/3.12.5/x64/lib/python3.12/site-packages/requests/adapters.py", line [68](https://github.com/arthurfsy2/XHS2Blog/actions/runs/10503181706/job/29096045736#step:5:69)8, in send
    raise ConnectTimeout(e, request=request)
requests.exceptions.ConnectTimeout: HTTPConnectionPool(host='xxx', port=xxxx): Max retries exceeded with url: /xhs/ (Caused by ConnectTimeoutError(<urllib3.connection.HTTPConnection object at 0x7f8df3fff3b0>, 'Connection to ddns.4a1801.life timed out. (connect timeout=None)'))

似乎是网络不稳定引起的,多试几次就好了