internetarchive / warc

Python library for reading and writing warc files
GNU General Public License v2.0
237 stars 114 forks source link

WARC: from_response incompatible with Requests>=1.0.0 #13

Open ersi opened 11 years ago

ersi commented 11 years ago

Description/Summary

Seems like warc-0.2.1 is incompatible with requests>=1.0.0. All that needs to be changed is to strip 'full' from 'full_url' and everything will work just fine again.

Environment details:

Python 2.7 warc 0.2.1 Requests 1.0.4

Example code

#!/usr/bin/python
import warc, requests

print warc.WARCRecord.from_response(requests.get("http://archive.org"))

Traceback

>>> warc.WARCRecord.from_response(requests.get("http://archive.org"))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ersi/venv/lib/python2.7/site-packages/warc/warc.py", line 240, in from_response
    "WARC-Target-URI": response.request.full_url.encode('utf-8')
AttributeError: 'PreparedRequest' object has no attribute 'full_url'