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

Problems with library ID when running zotcli configure a second time #18

Open
joelostblom opened this issue Feb 10, 2017 · 6 comments
Open

Comments

@joelostblom
Copy link
Contributor

When I run zotcli configure the first time, everything works as expected. However, if I try to run it a second time, I am prompted to enter my library ID (this prompt did not occur the first time). I have tried entering my Zotero login, but the configuration always errors with the following traceback:

Traceback (most recent call last):
  File "/home/joel/anaconda3/lib/python3.5/site-packages/pyzotero/zotero.py", line 284, in _retrieve_data
    self.request.raise_for_status()
  File "/home/joel/anaconda3/lib/python3.5/site-packages/requests/models.py", line 893, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: https://api.zotero.org/users/My%20Library/items/top?limit=100&format=json&since=1602

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/joel/anaconda3/bin/zotcli", line 11, in <module>
    sys.exit(cli())
  File "/home/joel/anaconda3/lib/python3.5/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/home/joel/anaconda3/lib/python3.5/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/home/joel/anaconda3/lib/python3.5/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/joel/anaconda3/lib/python3.5/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/joel/anaconda3/lib/python3.5/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/home/joel/anaconda3/lib/python3.5/site-packages/zotero_cli/cli.py", line 155, in configure
    zot = ZoteroBackend(config['api_key'], config['library_id'], 'user')
  File "/home/joel/anaconda3/lib/python3.5/site-packages/zotero_cli/backend.py", line 156, in __init__
    self.synchronize()
  File "/home/joel/anaconda3/lib/python3.5/site-packages/zotero_cli/backend.py", line 160, in synchronize
    new_items = tuple(self.items(since=self._index.library_version))
  File "/home/joel/anaconda3/lib/python3.5/site-packages/zotero_cli/backend.py", line 193, in items
    items = self._zot.makeiter(query_fn(**query_args))
  File "/home/joel/anaconda3/lib/python3.5/site-packages/pyzotero/zotero.py", line 127, in wrapped_f
    retrieved = self._retrieve_data(func(self, *args))
  File "/home/joel/anaconda3/lib/python3.5/site-packages/pyzotero/zotero.py", line 286, in _retrieve_data
    error_handler(self.request)
  File "/home/joel/anaconda3/lib/python3.5/site-packages/pyzotero/zotero.py", line 1342, in error_handler
    raise ze.HTTPError(err_msg(req))
pyzotero.zotero_errors.HTTPError:
Code: 500
URL: https://api.zotero.org/users/MyZoteroID/items/top?limit=100&format=json&since=1602
Method: GET
Response: An error occurred
@astholkohtz
Copy link

Hi, go to zotero.com and login. Then click on Settings > Feeds/API.
You will see "Your userID for use in API calls is ID".
That's the ID you have to use, not your login.
I hope this helps.

@joelostblom
Copy link
Contributor Author

Yes, that works, thank you!

@aetherfaerber
Copy link

I ran into the same problem. Thanks for the solution!

As I had to dig it up here and others may not be able to invest the time maybe it would be a good idea to put this in some kind of FAQ or clarify the prompt?

@jbaiter
Copy link
Owner

jbaiter commented Apr 3, 2017

A more clear prompt is probably the way to go. Do I understand correctly that this is about the Please enter your library ID? message? How about Please enter your user ID for API calls instead?

@joelostblom
Copy link
Contributor Author

Yes, that is definitely clearer.

I think part of of the problem is that if I enter "zotero user id for api calls" into a search engine, I don't get any immediately useful hints of where to go to find it. So, it might be worthwhile adding a line to the readme, spelling out how to get it.

If possible, getting the ID automatically somehow given the username would be a good way to go about it in my opinion. Maybe something here can help https://forums.zotero.org/discussion/42131/get-userid-from-username

@jbaiter
Copy link
Owner

jbaiter commented Apr 7, 2017

I will look into it, thanks for the link!

@jbaiter jbaiter reopened this Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants