mirror of
https://code.eliotberriot.com/funkwhale/funkwhale.git
synced 2025-10-04 03:19:16 +02:00
We now use a proper user agent including instance version and url during outgoing requests
This commit is contained in:
parent
99200ad077
commit
b5ff339efa
10 changed files with 47 additions and 19 deletions
18
api/funkwhale_api/common/session.py
Normal file
18
api/funkwhale_api/common/session.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
import requests
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
import funkwhale_api
|
||||
|
||||
|
||||
def get_user_agent():
|
||||
return 'python-requests (funkwhale/{}; +{})'.format(
|
||||
funkwhale_api.__version__,
|
||||
settings.FUNKWHALE_URL
|
||||
)
|
||||
|
||||
|
||||
def get_session():
|
||||
s = requests.Session()
|
||||
s.headers['User-Agent'] = get_user_agent()
|
||||
return s
|
Loading…
Add table
Add a link
Reference in a new issue