Skip to content

Commit

Permalink
Add user-agent to request
Browse files Browse the repository at this point in the history
  • Loading branch information
bpepple committed Oct 21, 2021
1 parent 2118ca9 commit dd92425
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion esak/session.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import datetime
import hashlib
import platform
import urllib.parse
from collections import OrderedDict
from typing import Any, Dict, List, Optional, Union
Expand All @@ -8,6 +9,7 @@
from marshmallow import ValidationError

from esak import (
__version__,
character,
characters_list,
comic,
Expand Down Expand Up @@ -92,8 +94,15 @@ def call(self, endpoint: List[Union[str, int]], params: Dict[str, Any] = None) -
if cached_response is not None:
return cached_response

header = {
"User-Agent": f"esak/{__version__} ({platform.system()}; {platform.release()})"
}
self._update_params(params)
response = requests.get(url, params=params)
response = requests.get(
url,
params=params,
headers=header,
)

data = response.json()

Expand Down

0 comments on commit dd92425

Please sign in to comment.