okxapi / python-okx

380 stars 148 forks source link

关于python api在中国大陆只能使用VPN代理请求问题 #5

Closed Hearty07 closed 1 year ago

Hearty07 commented 1 year ago

image

为什么在浏览器上直接访问url可以得到返回结果,并且在中国内陆可以不用代理而正常使用app。而python的api却需要使用VPN代理才能获取数据,否则就会出现如下错误,这是为什么?

result = marketapi.get_ticker(self.instid)

"C:\Users\Hearty\AppData\Local\Programs\Python\Python310\lib\site-packages\httpx_transports\default.py", line 77, in map_httpcore_exceptions raise mapped_exc(message) from exc httpx.ConnectError: [Errno 11004] getaddrinfo failed

okxapi commented 1 year ago

API调用的域名如果是国内的域名,就可以不用代理。SDK中默认的访问域名是www.okx.comhttp://www.okx.com,这个是需要代理的。

@.> 时间:2023年3月17日 (周五) 00:57 主题:[okxapi/python-okx] 关于python api在中国大陆只能使用VPN代理请求问题 (Issue #5) @.> @.> [image: image]https://user-images.githubusercontent.com/37877173/225693234-3837953f-da2c-44aa-8c0a-240526effde0.png为什么在浏览器上直接访问url可以得到返回结果,并且在中国内陆可以不用代理而正常使用app。而python的api却需要使用VPN代理才能获取数据,否则就会出现如下错误,这是为什么?result = marketapi.get_ticker(self.instid)"C:\Users\Hearty\AppData\Local\Programs\Python\Python310\lib\site-packages\httpx_transports\default.pyhttp://default.py", line 77, in map_httpcore_exceptions raise mapped_exc(message) from exc httpx.ConnectError: [Errno 11004] getaddrinfo failed— Reply to this email directly,view it on GitHubhttps://github.com/okxapi/python-okx/issues/5, orunsubscribehttps://github.com/notifications/unsubscribe-auth/A3R7I5CNGBE7C6XA3Z5FNDTW4NA7NANCNFSM6AAAAAAV5PLM4Q. You are receiving this because you are subscribed to this thread.[image: https://github.com/notifications/beacon/A3R7I5CJA3BL67HDR63LKL3W4NA7NA5CNFSM6AAAAAAV5PLM4SWGG33NNVSW45C7OR4XAZNFJFZXG5LFVJRW63LNMVXHIX3JMTHGCB7GKQ.gif]Message @.>