Skip to content

Invalid api urls don't fail gracefully #6

@santip

Description

@santip

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 :))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions