13 lines
456 B
Python
13 lines
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()
|