Skip to content

Commit e7faed0

Browse files
Loosen requirement for requests to 2.0 or higher
1 parent 1e676e4 commit e7faed0

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77

8+
## [Unreleased]
9+
### Added
10+
### Changed
11+
* Loosen requirement for requests to 2.0 or higher.
12+
### Deprecated
13+
### Fixed
14+
### Removed
15+
### Security
16+
17+
818
## [1.1.2] - 2021-09-21
919
### Changed
1020
* Improve request exception messages and include exception stacktraces.
@@ -66,6 +76,7 @@ Version increased to avoid conflicts with old packages on PyPI.
6676
Initial version.
6777

6878

79+
[Unreleased]: https://github.com/DeepLcom/deepl-python/compare/v1.1.2...HEAD
6980
[1.1.2]: https://github.com/DeepLcom/deepl-python/compare/v1.1.1...v1.1.2
7081
[1.1.1]: https://github.com/DeepLcom/deepl-python/compare/v1.1.0...v1.1.1
7182
[1.1.0]: https://github.com/DeepLcom/deepl-python/compare/v1.0.1...v1.1.0

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ poetry install
3434
### Requirements
3535
The library is tested with Python versions 3.6 to 3.9.
3636

37-
The `requests` module is used to perform HTTP requests; the minimum is version 2.18.
37+
The `requests` module is used to perform HTTP requests; the minimum is version 2.0.
3838

3939
## Usage
4040

deepl/http_client.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,14 @@ def request(
131131
return response.status_code, response
132132

133133
else:
134-
with self._session.request(
134+
response = self._session.request(
135135
method, url, data=data, timeout=timeout, **kwargs
136-
) as response:
136+
)
137+
try:
137138
response.encoding = "UTF-8"
138139
return response.status_code, response.text
140+
finally:
141+
response.close()
139142

140143
except requests.exceptions.ConnectionError as e:
141144
message = f"Connection failed: {e}"

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fail_under = 70
3636

3737
[tool.poetry.dependencies]
3838
python = ">=3.6.2,<4"
39-
requests = "^2.18"
39+
requests = "^2"
4040

4141
[tool.poetry.dev-dependencies]
4242
black = "^21.4b2"

0 commit comments

Comments
 (0)