Send a named user agent from the content tool
This commit is contained in:
1 parent
0f90babb7a
commit
da02748dca
1 file changed
+2
-1
@@ -8,6 +8,7 @@ from envfile import env_value
|
||||
DEFAULT_API_URL = "http://localhost:5000"
|
||||
IMAGE_PATH_PREFIX = "/api/library/images/"
|
||||
REQUEST_TIMEOUT_SECONDS = 60
|
||||
USER_AGENT = "sirblob-content-tool/1.0"
|
||||
|
||||
|
||||
class LibraryError(ValueError):
|
||||
@@ -49,7 +50,7 @@ def error_message(error: urllib.error.HTTPError) -> str:
|
||||
|
||||
def send(method: str, path: str, body: dict | None = None, signed: bool = True, site: Site | None = None):
|
||||
site = site or local_site()
|
||||
headers = {"Accept": "application/json"}
|
||||
headers = {"Accept": "application/json", "User-Agent": USER_AGENT}
|
||||
data = None
|
||||
if signed:
|
||||
headers["Authorization"] = f"Bearer {site.require_key()}"
|
||||
|
||||
Reference in new issue
Block a user