Skip to content

Commit

Permalink
Merge pull request #3 from tumb1er/content_from_response_iter
Browse files Browse the repository at this point in the history
Record content via iterating over response
  • Loading branch information
tumb1er authored Apr 6, 2020
2 parents fe8aa27 + aa6c931 commit 8b49386
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sitemap_generate/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ def record(self, url: str) -> bytes:
'QUERY_STRING': url.query,
'HTTP_X_FORWARDED_PROTO': defaults.SITEMAP_PROTO
}
response = self.wsgi(environ, self._start_response)
content = b''.join(self.wsgi(environ, self._start_response))
if self.status != "200 OK":
raise SitemapError(self.status, response.content)
return response.content
raise SitemapError(self.status, content)
return content

def _start_response(self, status, _):
""" WSGI headers callback func."""
Expand Down

0 comments on commit 8b49386

Please sign in to comment.