urschrei / pyzotero

Pyzotero: a Python client for the Zotero API
https://pyzotero.readthedocs.org
Other
911 stars 100 forks source link

File download not working properly #44

Closed cdeblois closed 9 years ago

cdeblois commented 9 years ago

Have file id from getting item. When I try to download the file I get the following.

>>> zfile = zotero_cloud._client.file("EPPE3IZB")
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/local/lib/python2.7/dist-packages/pyzotero/zotero.py", line 120, in wrapped_f
    retrieved = self._retrieve_data(func(self, *args))
  File "/usr/local/lib/python2.7/dist-packages/pyzotero/zotero.py", line 257, in _retrieve_data
    error_handler(self.request)
  File "/usr/local/lib/python2.7/dist-packages/pyzotero/zotero.py", line 1274, in error_handler
    raise error_codes.get(req.status_code)(err_msg(req))
UnsupportedParams:
Code: 400
URL: https://zoterofilestorage.s3.amazonaws.com/5b6ba34667afa55c0ea91c89ba693b46?response-content-type=application%2Fpdf&AWSAccessKeyId=AKIAI4IEEOCQFLSM5GMQ&Expires=1423627505&Signature=KYrT%2BEt8%2FUWeHnaft3rscApo%2Bm4%3D
Method: GET
Response: 
InvalidArgumentOnly one auth mechanism allowed; only the X-Amz-Algorithm query parameter, Signature query string parameter or the Authorization header should be specifiedAuthorizationBearer xykjPp4Z0jeaBDAudYEqYA6x46B22F07DBB20F1FTZMDeQh2Ef8aQfqCw9npdV3CpWs+AdJAW3hvPS7FCfEPx2UL4Pmp5OvZbrDirtDYiJoBMTi6nAk=

Any idea what I'm doing wrong here? I can take the above URL and put into the browser and the file comes right up.

Thanks

urschrei commented 9 years ago

I can't recreate this using my own library. Is this a user or group library? Was it working before?

cdeblois commented 9 years ago

It's a user library. It never worked for me from the beginning. My feeling is that it could be related to a distro package that I'm using that is possible out of date(tainted) or something but I'm not sure which one. It would be greatly appreciated if you have any idea which ones I should consider uninstalling/re-installing? Thanks!

pip freeze

Chameleon==2.6.1
Cheetah==2.4.4
Django==1.6.5
Flask==0.10.1
Jinja2==2.7.3
Landscape-Client==14.01
MarkupSafe==0.23
MySQL-python==1.2.3
PAM==0.4.2
Pillow==2.5.3
PyJWT==0.3.2
PyYAML==3.11
Pyzotero==1.1.2
SOAPpy==0.12.0
SecretStorage==2.0.0
South==0.7.6
Twisted-Core==13.2.0
Twisted-Names==13.2.0
Twisted-Web==13.2.0
VerbalExpressions==0.0.1
Werkzeug==0.9.6
amqp==1.4.6
anyjson==0.3.3
apt-xapian-index==0.45
argcomplete==0.6.3
argh==0.25.0
argparse==1.2.1
arrow==0.4.4
beautifulsoup4==4.1.3
billiard==3.3.0.18
biopython==1.62
boto==2.8.0
box==0.45.0
box.py==1.2.8
boxpython==1.0.5
bzr==2.7.0dev1
bzr-builddeb==2.8.6
celery==3.1.9
certifi==14.05.14
chardet==2.0.1
citeproc-py==0.3.0
cloud-init==0.7.5
colorama==0.2.5
configobj==4.7.2
distro-info==0.12
django-celery==3.1.9
django-chronograph==0.3.2.dev
django-jsonfield==0.9.13
django-registration==0.8
django-s3-folder-storage==0.2
django-sslserver==0.14
django-storages==1.1.8
django-supervisor==0.3.2
django-tinymce==1.5.2
django-tools==0.25.1
django.js==0.8.1
dnspython==1.11.1
dropbox==2.2.0
feedparser==5.1.3
fpconst==0.7.2
future==0.14.1
gbp==0.6.9
google-api-python-client==1.3.1
html5lib==0.999
httplib2==0.9
itsdangerous==0.24
jsonpatch==1.3
jsonpointer==1.0
keyring==3.5
kombu==3.0.21
launchpadlib==1.10.2
lazr.restfulclient==0.13.3
lazr.uri==1.0.3
lptools==0.2.0
lxml==3.3.3
meld3==1.0.0
memoized-property==1.0.2
mendeley==0.2.5
mongodbforms==0.2.2
mongoengine==0.8.3
nameparser==0.3.3
nose==1.3.0
oauth==1.0.1
oauth2==1.5.211
oauth2client==1.4.4
oauthlib==0.7.2
paramiko==1.10.0
path.py==3.0.1
pathtools==0.1.2
poster==0.8.1
prettytable==0.7.2
pyGravatar==0.0.5
pyOpenSSL==0.13
pyasn1==0.1.7
pyasn1-modules==0.0.5
pycrypto==2.6.1
pycurl==7.19.3
pydns==2.3.6
pygobject==3.12.0
pygpgme==0.3
pymongo==2.5
pyserial==2.6
python-apt==0.9.3.5
python-dateutil==1.5
python-debian==0.1.21-nmu2ubuntu2
python-debianbts==1.11
python-magic==0.4.6
python-openid==2.2.5
python-social-auth==0.1.26
pytz==2014.4
pyxdg==0.25
rauth==0.7.0
reportbug==6.5.0
requests==2.4.3
requests-oauthlib==0.4.2
rsa==3.1.4
rtfunicode==1.0
rtfw==0.2
simplejson==3.6.5
six==1.8.0
ssh-import-id==3.21
supervisor==3.1.1
ubuntu-dev-tools==0.153
uritemplate==0.6
urllib3==1.7.1
wadllib==1.3.2
watchdog==0.8.1
wheel==0.24.0
wsgiref==0.1.2
xmltodict==0.8.3
zope.interface==4.0.5
urschrei commented 9 years ago

The only thing I can imagine is that your Requests or Urllib3 version is causing a problem. The current Requests version is 2.5.1, while yours is 2.4.3. Similarly, the current Urllib3 version is 1.10.1 I'd start with those. If that doesn't work, try creating a blank virtualenv, and installing Pyzotero into that. At least that'll allow you to eliminate (or confirm) the possibility of an out-of-date or shadowed library.

cdeblois commented 9 years ago

After uninstalling and reinstalling the following:

feedparser==5.1.3
pytz==2014.10
Pyzotero==1.1.3
requests==2.5.1
six==1.9.0

Everything works now....Sorry to take your time here.