funkwhale/api/funkwhale_api/common/session.py

17 wiersze
324 B
Python
Czysty Zwykły widok Historia

import requests
from django.conf import settings
import funkwhale_api
def get_user_agent():
2018-06-09 13:36:16 +00:00
return "python-requests (funkwhale/{}; +{})".format(
funkwhale_api.__version__, settings.FUNKWHALE_URL
)
def get_session():
s = requests.Session()
2018-06-09 13:36:16 +00:00
s.headers["User-Agent"] = get_user_agent()
return s