Klaus-Uwe Mitterer
31b0eed298
Fix color picker Add exchange rate updater submodule Fix logging in celery A few invoicing fixes HTTP request class Navigation/URL updates
13 lines
No EOL
456 B
Python
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() |