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

Added an example for retry mechanism from #104 #105

Merged
merged 1 commit into from
Mar 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions docs/polarion_client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,26 @@ If this is the case, pass the new location using svn_repo_url. This is used whil

pol = polarion.Polarion('http://example.com/polarion', 'user', 'password', svn_repo_url='http://example.com/repo_location')

Retry Mechanism
---------------

A custom retry strategy can be set by using the request_session parameter of the polarion constructor. See example below.

.. code:: python
import requests
from requests.adapters import HTTPAdapter, Retry
from polarion import polarion

# example of a retry strategy
my_sess = requests.Session()
retries = Retry(total=5,
backoff_factor=0.1,
status_forcelist=[ 500, 502, 503, 504 ]) # only retry those status codes

my_sess.mount('http://', HTTPAdapter(max_retries=retries)) # for all http connections

pol = polarion.Polarion('http://example.com/polarion', 'user', 'password', request_session=my_sess)


Services
--------
Expand Down