add `timeout` when sending requests

Open Beginner friendly
#37 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
62/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
api

Research direction

Start in appcenter/derived_client.py at the session.get call referenced by the issue, then inspect how callers in appcenter/versions.py reach it. Compare the reported timeout=10 behavior with the current request path and decide how the timeout should be supplied. Done means requests no longer wait indefinitely and the chosen timeout behavior is covered by the project's available checks.

Written by the indexing model from the issue text.

Description

I wrote a scripts to pull version info every 30 seconds and when getting all versions by :
https://github.com/microsoft/appcenter-rest-python/blob/016008a64fbafbdc79dafd14a3ad7e41c4bedf6d/appcenter/versions.py#L113

I encounter a problem that the process seems stuck sometime and the last log i got is always:

[2023-11-02 04:35:03,968][INFO][appcenter.versions]	Getting versions of app: [******]
[2023-11-02 04:35:03,968][DEBUG][appcenter.versions]	Generated URL: https://api.appcenter.ms/v0.1/apps/[******]/[******]
[2023-11-02 04:35:03,968][DEBUG][urllib3.connectionpool]	Starting new HTTPS connection (8): api.appcenter.ms:443
[2023-11-02 04:35:28,896][DEBUG][urllib3.connectionpool]	https://api.appcenter.ms:443 "GET /v0.1/apps/[******]/[******]/releases?published_only=false&scope=tester HTTP/1.1" 200 990783

After investigation i confirm that it blames to the missing timeout setting when:
https://github.com/microsoft/appcenter-rest-python/blob/016008a64fbafbdc79dafd14a3ad7e41c4bedf6d/appcenter/derived_client.py#L187

and after changing to

response = self.session.get(url, timeout=10)

things seems normal and i will get TimeoutError as expected.

So could we add timeout argument? I am not sure should we set a default value or additionally expose it to the function that calls it.

Dominant language
Python
Stars
25
Forks
20
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/appcenter-rest-python

All issues in microsoft/appcenter-rest-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.