diff --git a/WPTParser/Fetch/__init__.py b/WPTParser/Fetch/__init__.py index 4d00a49..1cb61b8 100644 --- a/WPTParser/Fetch/__init__.py +++ b/WPTParser/Fetch/__init__.py @@ -1,5 +1,7 @@ import requests +from WPTParser import WPTParser + class Fetch(): def __init__(self, headers: dict = {}): @@ -10,7 +12,7 @@ def __init__(self, headers: dict = {}): def json(self, test_id: str='200518_Y2_c736f1cb25d54ac8cd93ebdfdcf6375b') -> dict: # api rejects the request with unauthorized if user-agent header not set - url = '/jsonResult.php?test={0}'.format(test_id) + url = '{0}/jsonResult.php?test={1}'.format(WPTParser().WPT_URI(), test_id) json_data = requests.get(url, headers = self.headers) json_data = json_data.json() return json_data \ No newline at end of file diff --git a/WPTParser/__init__.py b/WPTParser/__init__.py index ef900b2..6fef8ce 100644 --- a/WPTParser/__init__.py +++ b/WPTParser/__init__.py @@ -1,2 +1,9 @@ -class Config: - BASE_WPT_URI = 'https://www.webpagetest.org' \ No newline at end of file +class WPTParser: + + def __init__(self): + self._BASE_WPT_URI = 'https://www.webpagetest.org' + + def WPT_URI(self, wpt_uri: str = None): + if wpt_uri is not None: + self._BASE_WPT_URI = wpt_uri + return self._BASE_WPT_URI \ No newline at end of file diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..4fa5367 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,2 @@ +[metadata] +description-file = README.MD \ No newline at end of file diff --git a/setup.py b/setup.py index 38df74d..77e09c2 100644 --- a/setup.py +++ b/setup.py @@ -21,6 +21,7 @@ def read(fname): author_email="bharat.sinha.2307@gmail.com", description=description, long_description=long_description, + long_description_content_type='text/markdown', url="https://github.com/Bharat23/wpt-parser", packages=setuptools.find_packages(), license='MIT',