summaryrefslogtreecommitdiffstats
path: root/activities
diff options
context:
space:
mode:
authorMichael Manfre2022-12-06 23:59:05 -0500
committerGitHub2022-12-06 21:59:05 -0700
commit39a40e4dae8da8b6e7072fcbee2fc745c27c016d (patch)
treeb8f149b4d232cd4f5598535ded61cfb7dd121e78 /activities
parent126c7a14ecc89936ea5477d7baf1eb200da71f53 (diff)
downloadtakahe-39a40e4dae8da8b6e7072fcbee2fc745c27c016d.tar.gz
takahe-39a40e4dae8da8b6e7072fcbee2fc745c27c016d.tar.bz2
takahe-39a40e4dae8da8b6e7072fcbee2fc745c27c016d.zip
Set a Takahe User-Agent header for signed requests (#142)
Diffstat (limited to 'activities')
-rw-r--r--activities/models/post.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/activities/models/post.py b/activities/models/post.py
index 1017694..b0c89ac 100644
--- a/activities/models/post.py
+++ b/activities/models/post.py
@@ -5,6 +5,7 @@ from typing import Optional
import httpx
import urlman
from asgiref.sync import async_to_sync, sync_to_async
+from django.conf import settings
from django.contrib.postgres.indexes import GinIndex
from django.db import models, transaction
from django.template.defaultfilters import linebreaks_filter
@@ -696,7 +697,10 @@ class Post(StatorModel):
"""
response = httpx.get(
self.object_uri,
- headers={"Accept": "application/json"},
+ headers={
+ "Accept": "application/json",
+ "User-Agent": settings.TAKAHE_USER_AGENT,
+ },
follow_redirects=True,
)
if 200 <= response.status_code < 300: