Open xiboliyalang-cc opened 2 months ago
一样的问题,最近几天都刷不了,也不知道是什么导致的。
taobao获取时间戳的API用不了了,换个获取时间戳的API或者本地获取就行了
taobao获取时间戳的API用不了了,换个获取时间戳的API或者本地获取就行了
这里是在哪里改呢,大佬
taobao获取时间戳的API用不了了,换个获取时间戳的API或者本地获取就行了
找到了找到了, 我先改上然后看看还会不会提示错误,谢谢!
怎么我获取了最新的代码还是运行失败,提示
Traceback (most recent call last):
File "main.py", line 240, in
怎么我获取了最新的代码还是运行失败,提示 Traceback (most recent call last): File "main.py", line 240, in getBeijinTime() File "main.py", line 98, in getBeijinTime msg_mi += main(user_mi, passwd_mi, min_1, max_1) File "main.py", line 193, in main t = get_time() File "main.py", line 224, in get_time response = requests.get(url, headers=headers).json() File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/requests/models.py", line 978, in json raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
建议直接把时间戳改成从本地获取 run.yml:
- name: 开始
run: |
...
pip3 install pytz
...
main.py:
def get_time():
utc_now = datetime.datetime.utcnow()
beijing_tz = pytz.timezone('Asia/Shanghai')
beijing_now = utc_now.replace(tzinfo=pytz.utc).astimezone(beijing_tz)
t = int(beijing_now.timestamp() * 1000)
return t
最近出现好多这个,一天得三四个邮件推送了,是接口问题吗,佬 Collecting requests Downloading requests-2.32.3-py3-none-any.whl.metadata (4.6 kB) Collecting charset-normalizer<4,>=2 (from requests) Downloading charset_normalizer-3.3.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (33 kB) Collecting idna<4,>=2.5 (from requests) Downloading idna-3.9-py3-none-any.whl.metadata (10 kB) Collecting urllib3<3,>=1.21.1 (from requests) Downloading urllib3-2.2.3-py3-none-any.whl.metadata (6.5 kB) Collecting certifi>=2017.4.17 (from requests) Downloading certifi-2024.8.30-py3-none-any.whl.metadata (2.2 kB) Downloading requests-2.32.3-py3-none-any.whl (64 kB) Downloading certifi-2024.8.30-py3-none-any.whl (167 kB) Downloading charset_normalizer-3.3.2-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (141 kB) Downloading idna-3.9-py3-none-any.whl (71 kB) Downloading urllib3-2.2.3-py3-none-any.whl (126 kB) Installing collected packages: urllib3, idna, charset-normalizer, certifi, requests Successfully installed certifi-2024.8.30 charset-normalizer-3.3.2 idna-3.9 requests-2.32.3 urllib3-2.2.3 已设置为随机步数(24500~28000) Traceback (most recent call last): File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/urllib3/connection.py", line 199, in _new_conn sock = connection.create_connection( File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/urllib3/util/connection.py", line 85, in create_connection raise err File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/urllib3/util/connection.py", line 73, in create_connection sock.connect(sa) ConnectionRefusedError: [Errno 111] Connection refused
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/urllib3/connectionpool.py", line 789, in urlopen response = self._make_request( File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/urllib3/connectionpool.py", line 495, in _make_request conn.request( File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/urllib3/connection.py", line 441, in request self.endheaders() File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/http/client.py", line 1251, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/http/client.py", line 1011, in _send_output self.send(msg) File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/http/client.py", line 951, in send self.connect() File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/urllib3/connection.py", line 279, in connect self.sock = self._new_conn() File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/urllib3/connection.py", line 214, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7f5126734190>: Failed to establish a new connection: [Errno 111] Connection refused
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/requests/adapters.py", line 667, in send resp = conn.urlopen( File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/urllib3/connectionpool.py", line 843, in urlopen retries = retries.increment( File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/urllib3/util/retry.py", line 519, in increment raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='api.m.taobao.com', port=80): Max retries exceeded with url: /rest/api3.do?api=mtop.common.getTimestamp (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f5126734190>: Failed to establish a new connection: [Errno 111] Connection refused'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "main.py", line 240, in
getBeijinTime()
File "main.py", line 98, in getBeijinTime
msg_mi += main(user_mi, passwd_mi, min_1, max_1)
File "main.py", line 193, in main
t = get_time()
File "main.py", line 224, in get_time
response = requests.get(url, headers=headers).json()
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/requests/api.py", line 73, in get
return request("get", url, params=params, kwargs)
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/requests/api.py", line 59, in request
return session.request(method=method, url=url, kwargs)
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-