import requests_cache
+_headers = {
+ 'User-Agent': 'paperdoorknob/0.0.1 (https://git.scottworley.com/paperdoorknob/)'}
+
+
class Fetcher(ABC):
@abstractmethod
def fetch(self, url: str) -> bytes:
self._timeout = timeout
def fetch(self, url: str) -> bytes:
- with self._session.get(url, timeout=self._timeout) as r:
+ with self._session.get(url, timeout=self._timeout, headers=_headers) as r:
r.raise_for_status()
return r.content
self._cache_hit_count = 0
def fetch(self, url: str) -> bytes:
- with self._session.get(url, timeout=self._timeout) as r:
+ with self._session.get(url, timeout=self._timeout, headers=_headers) as r:
r.raise_for_status()
self._request_count += 1
self._cache_hit_count += int(r.from_cache)