Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions akshare/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ def make_request_with_retry_json(
"""
if proxies is None:
proxies = config.proxies
# Default headers mimicking a standard browser to avoid connection resets
if headers is None:
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
"Accept": "application/json, text/plain, */*",
"Accept-Language": "zh-CN,zh;q=0.9",
"Referer": "https://data.eastmoney.com/",
}
for attempt in range(max_retries):
try:
response = requests.get(
Expand Down