Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions billboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class ChartData:
(highest first).
"""

def __init__(self, name, date=None, fetch=True, timeout=25):
def __init__(self, name, date=None, fetch=True, timeout=25, headers={}):
"""Constructs a new ChartData instance.

Args:
Expand Down Expand Up @@ -146,6 +146,7 @@ def __init__(self, name, date=None, fetch=True, timeout=25):
self.previousDate = None

self._timeout = timeout
self._headers = headers

self.entries = []
if fetch:
Expand Down Expand Up @@ -196,7 +197,7 @@ def fetchEntries(self):
else:
url = "http://www.billboard.com/charts/%s/%s" % (self.name, self.date)

req = requests.get(url, timeout=self._timeout)
req = requests.get(url, timeout=self._timeout, headers=self._headers)
if req.status_code == 404:
message = "Chart not found (perhaps the name is misspelled?)"
raise BillboardNotFoundException(message)
Expand Down