Type/to search
12
Follow
57
Followers
Lỗi kết nối khi sử dụng urllib để đọc thông tin trao đổi
Help
Created 2019-12-22 09:16:42  
 5
 1652

Tôi đã thử đọc thông tin trực tiếp từ sàn giao dịch, và đây là mã:

from urllib import request
def fetch_url_data(url):
try:
req = request.urlopen{url).read{).decode{'utf-8') # request{url}{GET}
return json.loads(req)
except Exception as e:
print ((' giao diện giao dịch phát hiện lỗi:', e)
url = "https://www.okex.me/api/spot/v3/instruments"
data = fetch_url_data(url)

Các nhà nghiên cứu đã có thể đọc được dữ liệu, nhưng khi truy cập vào phản hồi, họ nhận được thông báo lỗi như sau:

urllib.error.URLError: <urlopen error [Errno 111] Connection refused

Tôi đã nghiên cứu trong nửa ngày, có người nói rằng máy chủ đã thiết lập proxy, có người nói rằng Python3 đã thay đổi cách sử dụng thư viện urllib, xin vui lòng nói với Chúa là điều gì.

Related Recommendations
Comment
All comments (5)

    网格这个 支持bigone吗

    6 years ago

    FMZ支持就可以

    6 years ago

    国内服务器无法访问

    7 years ago

    是回测系统的问题,这是一个沙盒模式,不能访问外网的,我实盘测试就ok了 ^^

    7 years ago

    嗯,回测不能联网,应该能理解原因吧

    7 years ago
  • 1
iPhone Download
Forums
PINE Language
© 2015 - ∞ INVENTOR PTE LTD (SG)