Skip to content

Commit

Permalink
update config
Browse files Browse the repository at this point in the history
  • Loading branch information
Bharat23 committed May 19, 2020
1 parent e1edd39 commit 8e72d6b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
4 changes: 3 additions & 1 deletion WPTParser/Fetch/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import requests

from WPTParser import WPTParser

class Fetch():

def __init__(self, headers: dict = {}):
Expand All @@ -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
11 changes: 9 additions & 2 deletions WPTParser/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
class Config:
BASE_WPT_URI = 'https://www.webpagetest.org'
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
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[metadata]
description-file = README.MD
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def read(fname):
author_email="[email protected]",
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',
Expand Down

0 comments on commit 8e72d6b

Please sign in to comment.