[feat] set httpx timeout to 10
All checks were successful
/ run-pytest (push) Successful in 55s

This commit is contained in:
SouthFox 2024-03-10 01:02:21 +08:00
parent ef5391787a
commit 47e615ebf4

View file

@ -12,7 +12,7 @@
(with/a [client (.AsyncClient httpx)] (with/a [client (.AsyncClient httpx)]
(let [headers {"User-Agent" config.USER_AGENT (let [headers {"User-Agent" config.USER_AGENT
"Accept" config.AP_CONTENT_TYPE}] "Accept" config.AP_CONTENT_TYPE}]
(await (.get client url :headers headers))))))) (await (.get client url :headers headers :timeout 15)))))))
(defn/a post (defn/a post
[url payload] [url payload]
@ -20,6 +20,6 @@
(let [headers {"User-Agent" config.USER_AGENT (let [headers {"User-Agent" config.USER_AGENT
"Accept" config.AP_CONTENT_TYPE}] "Accept" config.AP_CONTENT_TYPE}]
(setv resp (setv resp
(await (.post client url :headers headers :json payload :auth auth))) (await (.post client url :headers headers :json payload :auth auth :timeout 15)))
(.raise_for_status resp) (.raise_for_status resp)
(return resp)))) (return resp))))