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

Invalid api urls don't fail gracefully #6

Open
santip opened this issue Jul 13, 2011 · 0 comments
Open

Invalid api urls don't fail gracefully #6

santip opened this issue Jul 13, 2011 · 0 comments

Comments

@santip
Copy link
Member

santip commented Jul 13, 2011

Code such as the following:

api_client = ApiClient('INDEX_TANK_URL')

raise an ugly exception, and not on the client creation but on using the client to do a request, for instance:

  File "/home/edu/workspace/crawler/backend/user/app/lib/structured_indexer/sourcer.py", line 92, in submit
    response = index.add_documents(document_list)
  File "/usr/local/lib/python2.7/dist-packages/indextank/client.py", line 165, in add_documents
    return _request('PUT', self.__docs_url(), data=documents)
  File "/usr/local/lib/python2.7/dist-packages/indextank/client.py", line 395, in _request
    netloc_noauth = netloc.split('@')[1]
IndexError: list index out of range

Invalid urls should be caught on the constructor and we should probably support public urls too (the failing line of code suggests we don't :))

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

1 participant