diff --git a/freckle.py b/freckle.py index 0bc3084..42c4748 100644 --- a/freckle.py +++ b/freckle.py @@ -36,9 +36,14 @@ def __init__(self, account, token): def request(self, url, method="GET", body=""): """Make a request to Freckle and return Python objects""" - resp, content = self.http.request(url, method, body, + resp, content = self.http.request(url, method, body, headers=self.headers) - return self.parse_response(content) + + content = self.parse_response(content) + if "link" in resp and "next" in resp['link']: + content += self.request(resp["link"].split(";")[0][1:-1]) + + return content def get_entries(self, **kwargs): """ @@ -80,7 +85,7 @@ def get_users(self): def get_projects(self): """Get projects from Freckle""" return self.request("%s/projects.xml" % self.endpoint) - + def parse_response(self, xml_content): """Parse XML response into Python""" content = [] @@ -105,7 +110,7 @@ def boolean_as_python(self, val): return True else: return False - + def date_as_python(self, val): """Convert text to date""" return datetime.date(*[int(x) for x in val.split("-")])