gateio/gateapi-go

gateio-api failure

Closed this issue · 5 comments

I have an API connection exception when using official gateio-api. can you help me solve this problem

I can be sure that my Key and Secret are correct, but the connection is abnormal.

`2022-07-19T14:58:45.614+0800 info util/logger.go:122 log format is success.
2022-07-19T14:59:06.713+0800 error bitcoin/main.go:38 Get "https://api.gateio.ws/api/v4/delivery/usdt/contracts": dial tcp 65.49.68.152:443: connectex: A connection attem
pt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.

Process finished with exit code 0
`

Where is your client located? Have you tried to set up a proxy in your HTTP client?

I can open this connection using HTTP.
image

If you're using proxies, your browser might respect your system proxy settings, but your code is not.
You need to create your own http.Client and setup the Proxy in it (which is Googleable), then set it into your gateapi client like the following:

config := gateapi.NewConfiguration()
config.HTTPClient = <your-new-http-client>
client := gateapi.NewAPIClient(config)
...

What you said is reasonable. I'll try.

Indeed, I succeeded by hanging on the server in Hong Kong. Thank you for your answer.