Skip to content

Commit

Permalink
Enables headers on parser
Browse files Browse the repository at this point in the history
  • Loading branch information
egarciadiaz committed Dec 12, 2023
1 parent 1be99d3 commit a66b992
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion esios/archives.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


def parser_none(body, code, headers):
return body
return body, headers


class Archive(base.RESTResource):
Expand Down
2 changes: 1 addition & 1 deletion esios/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def config_validators(self, pos):
self.provisional_parser = objectify.makeparser(schema=xmlschema)

def get_data_json(self, program_unit, start, end):
res = self.download(start, end)
res, headers = self.download(start, end)
return self.parse_to_json(res, program_unit)

def get_data_json_from_file(self, program_unit, filepath):
Expand Down
10 changes: 5 additions & 5 deletions spec/archives_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def test_expected_to_work(the_class, start, end, expected_versions, next=0):
"""
General expected to work method
"""
res = the_class().download(start, end, next=next)
res, headers = the_class().download(start, end, next=next)

c = BytesIO(res)
zf = zipfile.ZipFile(c)
Expand All @@ -33,7 +33,7 @@ def test_expected_to_break(the_class, start, end, assert_message, next=0):
"""
it_works = True
try:
res = the_class().download(start, end, next=next)
res, headers = the_class().download(start, end, next=next)
except:
it_works = False

Expand Down Expand Up @@ -264,7 +264,7 @@ def validate_P48cierre(xml):

start = today.replace(hour=0, minute=0, second=0, microsecond=0) - relativedelta.relativedelta(days=1)
end = today.replace(hour=23, minute=59, second=59, microsecond=0) - relativedelta.relativedelta(days=1)
res = P48Cierre(self.e).download(start, end)
res, headers = P48Cierre(self.e).download(start, end)

assert validate_P48cierre(res)
assert not validate_P48cierre(res + b'ERROR')
Expand All @@ -274,7 +274,7 @@ def validate_P48cierre(xml):

start = today.replace(hour=0, minute=0, second=0, microsecond=0) - relativedelta.relativedelta(days=1)
end = today.replace(hour=23, minute=59, second=59, microsecond=0)
res = P48Cierre(self.e).download(start, end)
res, headers = P48Cierre(self.e).download(start, end)

c = BytesIO(res)
zf = zipfile.ZipFile(c)
Expand All @@ -298,7 +298,7 @@ def validate_P48cierre(xml):
last_month_day = calendar.monthrange(today.year, today.month)[1]
end = datetime(today.year, today.month, today.day > 1 and today.day - 1 or 1)

res = P48Cierre(self.e).download(start, end)
res, headers = P48Cierre(self.e).download(start, end)

c = BytesIO(res)
zf = zipfile.ZipFile(c)
Expand Down

0 comments on commit a66b992

Please sign in to comment.