Skip to content

Commit 20474ca

Browse files
committed
Fix session location
1 parent 8fd9ae4 commit 20474ca

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tranco/tranco.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ def __init__(self, date, list_id, lst):
1313
self.list_id = list_id
1414
self.list_page = "https://tranco-list.eu/list/{}/1000000".format(list_id)
1515
self.list = {domain: index for index, domain in enumerate(lst, start=1)}
16-
self.session = requests.Session()
17-
self.session.headers.update({'User-Agent': 'Python/{} python-requests/{} tranco-python/{}'.format(sys.version, requests.__version__, VERSION)})
1816

1917
def top(self, num=1000000):
2018
return sorted(self.list, key=self.list.get)[:num]
@@ -44,6 +42,9 @@ def __init__(self, **kwargs):
4442
self.account_email = kwargs.get('account_email')
4543
self.api_key = kwargs.get('api_key')
4644

45+
self.session = requests.Session()
46+
self.session.headers.update({'User-Agent': 'Python/{} python-requests/{} tranco-python/{}'.format(sys.version, requests.__version__, VERSION)})
47+
4748
def _cache_path(self, date):
4849
return os.path.join(self.cache_dir, date + '-DEFAULT.csv')
4950

0 commit comments

Comments
 (0)