expephalon/core/classes/http.py
Klaus-Uwe Mitterer 31b0eed298 Add currency management
Fix color picker
Add exchange rate updater submodule
Fix logging in celery
A few invoicing fixes
HTTP request class
Navigation/URL updates
2020-06-03 12:35:23 +02:00

13 lines
No EOL
456 B
Python

from urllib.request import Request, urlopen
from core.helpers.expephalon import version_string
class HTTP:
def __init__(self, url, no_user_agent=False, *args, **kwargs):
self.request = Request(url, *args, **kwargs)
if not no_user_agent:
self.request.add_header("User-Agent", f"Expephalon/{version_string} (https://kumi.systems/)")
self.fetch()
def fetch(self):
self.data = urlopen(self.request).read()