Skip to content
This repository was archived by the owner on Aug 26, 2021. It is now read-only.
This repository was archived by the owner on Aug 26, 2021. It is now read-only.

MongoDB URI with multiple nodes (host:port separated by a comma) raises invalid literal for int() error #33

Description

@kierandarcy

A MongoDB URI can specify multiple, comma separated host:port URL parts like this:

mongodb://username:password@host1:123,host2:456/database

A URL in this form will result in an error:

ValueError: invalid literal for int() with base 10

I have a solution which uses pymongo.uri_parser.parse_uri (if installed) to parse the the MongoDB URL, selecting the first node (or, host:port) to extract the port, hostname and database.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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