Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enables headers on parser. Utility for libFacturacioATR #53

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
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
Loading