Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

read time out #15

Open
essramos opened this issue Apr 24, 2019 · 6 comments
Open

read time out #15

essramos opened this issue Apr 24, 2019 · 6 comments

Comments

@essramos
Copy link

essramos commented Apr 24, 2019

Hey Jim,

We are getting these errors, I know it might not relate to the library. But I am wondering if you are getting these as well?

Any idea why this is happening?

Traceback (most recent call last):
  File "/app/.heroku/python/lib/python3.6/site-packages/rq/worker.py", line 799, in perform_job
    rv = job.perform()
  File "/app/.heroku/python/lib/python3.6/site-packages/rq/job.py", line 600, in perform
    self._result = self._execute()
  File "/app/.heroku/python/lib/python3.6/site-packages/rq/job.py", line 606, in _execute
    return self.func(*self.args, **self.kwargs)
  File "/app/agilascout_api/clock_helpers/shopee_logistics.py", line 70, in sync_logistics_shopee
    logistics = logistic.get_logistic_message(shop_id, partner_id, secret_key, ordersn=row.order_id)
  File "/app/agilascout_api/shopee_client/logistic.py", line 6, in get_logistic_message
    return client.logistic.get_logistic_message(**kwargs)
  File "/app/.heroku/python/lib/python3.6/site-packages/pyshopee/logistic.py", line 46, in get_logistic_message
    return self.client.execute("logistics/tracking", "POST", kwargs)
  File "/app/.heroku/python/lib/python3.6/site-packages/pyshopee/client.py", line 140, in execute
    resp = s.send(prepped, timeout=10)
  File "/app/.heroku/python/lib/python3.6/site-packages/raven/breadcrumbs.py", line 341, in send
    resp = real_send(self, request, *args, **kwargs)
  File "/app/.heroku/python/lib/python3.6/site-packages/requests/sessions.py", line 646, in send
    r = adapter.send(request, **kwargs)
  File "/app/.heroku/python/lib/python3.6/site-packages/requests/adapters.py", line 529, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='partner.shopeemobile.com', port=443): Read timed out. (read timeout=10)
@JimCurryWang
Copy link
Owner

Hi @essramos,

I think it might be a temporary internal server issue for the Shopee Open Platform.

Did you get this so often?

@JimCurryWang
Copy link
Owner

Maybe you can change the timeout params by yourself, however, I think 10 seconds is long enough for the API call.
(My Advice is waiting so patiently until the server become normal again)

# https://github.com/JimCurryWang/python-shopee/blob/master/pyshopee/client.py

 def execute(self, uri, method, body=None):
        ... 
        ... 
        s = Session()
        resp = s.send(prepped, timeout=10)
        resp = self._build_response(resp)
        return resp

And here are some requests exceptions explainations.
https://github.com/kennethreitz/requests/blob/master/requests/exceptions.py

@essramos
Copy link
Author

We manually increased the timeout to 15 and we are not seeing timeouts anymore, is there anyway to expose the timeout parameter?

@JimCurryWang
Copy link
Owner

Good Idea, maybe we can try it then.

@JimCurryWang
Copy link
Owner

JimCurryWang commented Apr 25, 2019

@essramos,

I have made a PR in bbada2f .

Now we can add timeout params in each of your functions like below.

Maybe you can help me have a test or add this feature in the README document.

# demo
response = shopee.logistic.get_logistics(timeout=15)
print(response)

@essramos
Copy link
Author

essramos commented Apr 25, 2019

Thank you! Will try it out and let you know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants