Skip to content

Commit d0610f3

Browse files
committed
Move to requests from httpx to support Python 3.5
1 parent cc1bc53 commit d0610f3

File tree

3 files changed

+65
-178
lines changed

3 files changed

+65
-178
lines changed

paddle/paddle.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import os
33
from urllib.parse import urljoin
44

5-
import httpx
5+
import requests
66

77
log = logging.getLogger(__name__)
88

@@ -12,7 +12,7 @@ class PaddleException(Exception):
1212
def __init__(self, error):
1313
self.code: str = 'Unknown'
1414
self.message = error
15-
if isinstance(error, httpx.HTTPError): # pragma: no cover - Unsure how to trigger a HTTPError here # NOQA: E501
15+
if isinstance(error, requests.HTTPError): # pragma: no cover - Unsure how to trigger a HTTPError here # NOQA: E501
1616
self.code = 'HTTP error {0}'.format(error.response.status_code)
1717
self.message = error.response.content.decode("utf-8")
1818
elif isinstance(error, dict):
@@ -93,10 +93,10 @@ def request(
9393
if params:
9494
kwargs['params'] = params
9595

96-
response = httpx.request(**kwargs)
96+
response = requests.request(**kwargs)
9797
try:
9898
response.raise_for_status()
99-
except httpx.HTTPError as e: # pragma: no cover - Unsure how to trigger a HTTPError here # NOQA: E501
99+
except requests.HTTPError as e: # pragma: no cover - Unsure how to trigger a HTTPError here # NOQA: E501
100100
raise PaddleException(e)
101101

102102
response_json: dict = response.json()

poetry.lock

+59-172
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ description = "Wrapper around the Paddle API"
55
authors = ["Matt Pye <pyematt@gmail.com>"]
66

77
[tool.poetry.dependencies]
8-
python = "^3.6"
9-
httpx = "^0.13.1"
8+
python = "^3.5"
9+
requests = "^2.23.0"
1010

1111
[tool.poetry.dev-dependencies]
1212
pytest = "^4.6"

0 commit comments

Comments
 (0)