Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit46acfbf

Browse files
committed
handled timeout error
1 parent5253fd0 commit46acfbf

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

‎ipinfo/handler.py‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,12 @@ def getBatchDetails(
204204
chunk=lookup_addresses[i :i+batch_size]
205205

206206
# lookup
207-
response=requests.post(
208-
url,json=chunk,headers=headers,**req_opts
209-
)
207+
try:
208+
response=requests.post(
209+
url,json=chunk,headers=headers,**req_opts
210+
)
211+
exceptExceptionase:
212+
returnhandler_utils.return_or_fail(raise_on_fail,e,result)
210213

211214
# fail on bad status codes
212215
try:

‎ipinfo/handler_async.py‎

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -264,12 +264,15 @@ async def _do_batch_req(
264264
"""
265265
Coroutine which will do the actual POST request for getBatchDetails.
266266
"""
267-
resp=awaitself.httpsess.post(
268-
url,
269-
data=json.dumps(chunk),
270-
headers=headers,
271-
timeout=timeout_per_batch,
272-
)
267+
try:
268+
resp=awaitself.httpsess.post(
269+
url,
270+
data=json.dumps(chunk),
271+
headers=headers,
272+
timeout=timeout_per_batch,
273+
)
274+
exceptExceptionase:
275+
returnhandler_utils.return_or_fail(raise_on_fail,e,None)
273276

274277
# gather data
275278
try:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp