Skip to content

Commit bfdf118

Browse files
Merge pull request #2 from AlexAlexandreAlves/dev
feat: update readme and translate file to english
2 parents 524e20e + c638ed9 commit bfdf118

File tree

2 files changed

+34
-24
lines changed

2 files changed

+34
-24
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,17 @@ Reusable test fixtures:
6666
### 1. Install Dependencies
6767

6868
```bash
69+
### Cloning the repository
70+
git clone https://github.com/AlexAlexandreAlves/api-batch-test.git
71+
72+
### Run through the venv (virtual environment), for this, you need to create and activate it first
73+
python3 -m venv {$name}
74+
source {$name}/bin/activate
75+
76+
### Copy all folders and files in the main project and past into your recent created env-folder, and then install the dependencies:
77+
cd {your-venv-folder}
6978
pip install -r requirements.txt
79+
7080
```
7181

7282
**Key Dependencies**:

api-batch-test/src/api_client.py

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@
77

88

99
class APIClient:
10-
"""Cliente API com suporte a retry, rate-limit e formatação de URLs."""
10+
"""API client with retry, rate-limit, and URL formatting support."""
1111

1212
def __init__(self, base_url: str, connect_timeout: float, read_timeout: float, retry_total: int, rate_sleep: float):
1313
"""
14-
Inicializa o cliente API.
14+
Initialize the API client.
1515
1616
Args:
17-
base_url: URL base da API
18-
connect_timeout: Timeout de conexão em segundos
19-
read_timeout: Timeout de leitura em segundos
20-
retry_total: Total de tentativas para requisições
21-
rate_sleep: Tempo de espera entre requisições (rate-limit)
17+
base_url: API Base URL
18+
connect_timeout: Connection timeout in seconds
19+
read_timeout: Read timeout in seconds
20+
retry_total: Retry total attempts
21+
rate_sleep: Wait time between requests to handle rate limiting
2222
"""
2323
self.base_url = base_url.rstrip("/")
2424
self.session = requests.Session()
@@ -38,22 +38,22 @@ def __init__(self, base_url: str, connect_timeout: float, read_timeout: float, r
3838
self.rate_sleep = rate_sleep
3939

4040
def _build_url(self, endpoint: str, **path_params) -> str:
41-
"""Constrói a URL completa formatando parametros de caminho."""
41+
"""Build full URL with path parameters."""
4242
if path_params:
4343
endpoint = endpoint.format(**path_params)
44-
# Se já é uma URL completa, retorna como está
44+
# If endpoint is a full URL, return it as is
4545
if endpoint.startswith("http://") or endpoint.startswith("https://"):
4646
return endpoint
4747
return f"{self.base_url}/{endpoint.lstrip('/')}"
4848

4949
def get(self, endpoint: str, params=None, **kwargs) -> requests.Response:
5050
"""
51-
Faz uma requisição GET.
51+
Make a GET request.
5252
5353
Args:
54-
endpoint: Endpoint da API (pode ter placeholders como {id})
55-
params: Parâmetros de query
56-
**kwargs: Parâmetros de caminho como id=123
54+
endpoint: API endpoint (can have placeholders like {id})
55+
params: Query parameters
56+
**kwargs: Path parameters such as id=123
5757
5858
Returns:
5959
Response object
@@ -64,12 +64,12 @@ def get(self, endpoint: str, params=None, **kwargs) -> requests.Response:
6464

6565
def post(self, endpoint: str, data=None, **kwargs) -> requests.Response:
6666
"""
67-
Faz uma requisição POST.
67+
Make a POST request.
6868
6969
Args:
70-
endpoint: Endpoint da API
71-
data: Dados a enviar no body (será convertido para JSON)
72-
**kwargs: Parâmetros de caminho
70+
endpoint: API endpoint
71+
data: Data to send in the body (will be converted to JSON)
72+
**kwargs: Path parameters
7373
7474
Returns:
7575
Response object
@@ -80,12 +80,12 @@ def post(self, endpoint: str, data=None, **kwargs) -> requests.Response:
8080

8181
def put(self, endpoint: str, data=None, **kwargs) -> requests.Response:
8282
"""
83-
Faz uma requisição PUT.
83+
Make a PUT request.
8484
8585
Args:
86-
endpoint: Endpoint da API
87-
data: Dados a enviar no body (será convertido para JSON)
88-
**kwargs: Parâmetros de caminho
86+
endpoint: API endpoint
87+
data: Data to send in the body (will be converted to JSON)
88+
**kwargs: Path parameters
8989
9090
Returns:
9191
Response object
@@ -96,11 +96,11 @@ def put(self, endpoint: str, data=None, **kwargs) -> requests.Response:
9696

9797
def delete(self, endpoint: str, **kwargs) -> requests.Response:
9898
"""
99-
Faz uma requisição DELETE.
99+
Make a DELETE request.
100100
101101
Args:
102-
endpoint: Endpoint da API
103-
**kwargs: Parâmetros de caminho
102+
endpoint: API endpoint
103+
**kwargs: Path parameters
104104
105105
Returns:
106106
Response object

0 commit comments

Comments
 (0)