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

docs: add more info about the EXTENDED_REQUEST_PARAMS option #154

Merged
merged 1 commit into from
Apr 4, 2024
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
47 changes: 47 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,53 @@ print(client.projects.with_fetch_all().list_projects())
print(client.projects.with_fetch_all(1000).list_projects())
```

### Extended request parameters

The `EXTENDED_REQUEST_PARAMS` parameter allows you to set additional parameters for requests. For example, you can configure proxies or certificates.

The Client uses the [requests](https://pypi.org/project/requests/) library to make HTTP requests. You can pass any parameters that `requests` supports:

```python
def request(
self,
method,
url,
params=None,
data=None,
headers=None,
cookies=None,
files=None,
auth=None,
timeout=None,
allow_redirects=True,
proxies=None,
hooks=None,
stream=None,
verify=None,
cert=None,
json=None,
):
```

For example, you can set a [proxy](https://requests.readthedocs.io/en/latest/api/#requests.Session.proxies):

```python
from crowdin_api import CrowdinClient

http_proxy = "http://10.10.1.10:3128"
https_proxy = "https://10.10.1.11:1080"
ftp_proxy = "ftp://10.10.1.10:3128"

proxies = {
"http": http_proxy,
"https": https_proxy,
"ftp": ftp_proxy
}

class FirstCrowdinClient(CrowdinClient):
EXTENDED_REQUEST_PARAMS = {"proxies": proxies}
```

## Seeking Assistance

If you find any problems or would like to suggest a feature, please read the [How can I contribute](https://github.com/crowdin/crowdin-api-client-python/blob/main/CONTRIBUTING.md#how-can-i-contribute) section in our contributing guidelines.
Expand Down
Loading