Compare commits

..

6 Commits
v0.1.4 ... main

Author SHA1 Message Date
ecc414558a 🤖 Bumped version to 0.1.6
All checks were successful
Package Python / Package-Python-And-Publish (push) Successful in 25s
Run Python tests (through Pytest) / Test (push) Successful in 28s
Verify Python project can be installed, loaded and have version checked / Test (push) Successful in 25s
This commit was automatically generated by [a script](https://gitfub.space/Jmaa/repo-manager)
2025-07-16 12:53:41 +02:00
3b16f60ab0 Added PRE_ORDER
All checks were successful
Run Python tests (through Pytest) / Test (push) Successful in 28s
Verify Python project can be installed, loaded and have version checked / Test (push) Successful in 26s
2025-07-15 17:07:37 +02:00
06e12a8467 🤖 Bumped version to 0.1.5
All checks were successful
Package Python / Package-Python-And-Publish (push) Successful in 25s
Run Python tests (through Pytest) / Test (push) Successful in 28s
Verify Python project can be installed, loaded and have version checked / Test (push) Successful in 25s
This commit was automatically generated by [a script](https://gitfub.space/Jmaa/repo-manager)
2025-07-14 00:56:13 +02:00
7a3bcc05b3 🤖 Repository layout updated to latest version
This commit was automatically generated by [a script](https://gitfub.space/Jmaa/repo-manager)
2025-07-14 00:55:53 +02:00
8b34f6d475 Fixed __version__
All checks were successful
Run Python tests (through Pytest) / Test (push) Successful in 28s
Verify Python project can be installed, loaded and have version checked / Test (push) Successful in 25s
2025-07-14 00:52:20 +02:00
35554771d4 Ruff and __version
Some checks failed
Run Python tests (through Pytest) / Test (push) Failing after 28s
Verify Python project can be installed, loaded and have version checked / Test (push) Failing after 28s
2025-07-13 23:57:01 +02:00
6 changed files with 23 additions and 16 deletions

View File

@ -1,5 +1,5 @@
"""# Common HTTP/REST clients interface
"""
"""# Common HTTP/REST clients interface"""
import urllib.parse
import abc
@ -11,6 +11,10 @@ import bs4
import lxml.html
import requests
from ._version import __version__
__all__ = ['__version__']
logger = logging.getLogger(__name__)
@ -41,7 +45,9 @@ class AbstractClient(abc.ABC):
def fetch(self, url: str, **kwargs) -> requests.Response:
r = self._fetch(url, **kwargs)
if r.status_code in {301, 302, 303}:
msg = f'Redirection: {r.request.method} {url} -> GET {r.headers["Location"]}'
msg = (
f'Redirection: {r.request.method} {url} -> GET {r.headers["Location"]}'
)
raise Exception(msg)
r.raise_for_status()
return r
@ -51,7 +57,9 @@ class AbstractClient(abc.ABC):
kwargs.setdefault('allow_redirects', True)
url_parsed = urllib.parse.urlparse(url)
origin_url = url_parsed._replace(path='',params='',query='',fragment='').geturl()
origin_url = url_parsed._replace(
path='', params='', query='', fragment=''
).geturl()
kwargs.setdefault('headers', {}).setdefault('Origin', origin_url)
kwargs.setdefault('headers', {}).setdefault('Alt-Used', url_parsed.hostname)

View File

@ -1 +1 @@
__version__ = '0.1.4'
__version__ = '0.1.6'

View File

@ -15,6 +15,7 @@ DEFAULT_MAX_RESULTS = 1
URL = str
@dataclasses.dataclass(frozen=True, order=True, slots=True)
class SellerInfo:
name: str
@ -39,6 +40,7 @@ class StoreOfferProperty(enum.Enum):
AUCTION = enum.auto()
SOLD_OUT = enum.auto()
DISCOUNT = enum.auto()
PRE_ORDER = enum.auto()
@dataclasses.dataclass(frozen=True, order=True, slots=True)

View File

@ -7,6 +7,7 @@ import dataclasses
logger = logging.getLogger(__name__)
@dataclasses.dataclass(frozen=True)
class WishlistItem:
"""A single wishlished product."""
@ -19,7 +20,6 @@ class WishlistItem:
class WishlistClient(abc.ABC):
@abc.abstractmethod
def get_wishlist(self) -> Sequence[WishlistItem]:
pass

View File

@ -10,8 +10,7 @@ from setuptools import setup
PACKAGE_NAME = 'clients_protocol'
PACKAGE_DESCRIPTION = """
# Common HTTP/REST clients interface
""".strip()
# Common HTTP/REST clients interface""".strip()
PACKAGE_DESCRIPTION_SHORT = """
""".strip()

View File

@ -1,5 +1,3 @@
def test_init():
import clients_protocol
import clients_protocol.autoload