From 8280fd90c5c7f9dc62564f54ed1ff612377217b7 Mon Sep 17 00:00:00 2001 From: Ilya Skriblovsky Date: Mon, 25 Mar 2019 09:22:21 +0300 Subject: [PATCH] support for mongodb+srv:// uri scheme --- setup.py | 3 +++ txmongo/connection.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index bc297db..7e2a4d3 100755 --- a/setup.py +++ b/setup.py @@ -11,6 +11,9 @@ keywords=["mongo", "mongodb", "pymongo", "gridfs", "txmongo"], packages=["txmongo", "txmongo._gridfs"], install_requires=["twisted>=14.0", "pymongo>=3.0"], + extras_require={ + 'srv': ['pymongo[srv]>=3.6'], + }, license="Apache License, Version 2.0", include_package_data=True, test_suite="nose.collector", diff --git a/txmongo/connection.py b/txmongo/connection.py index 6f0aa96..ef76ed3 100755 --- a/txmongo/connection.py +++ b/txmongo/connection.py @@ -251,7 +251,7 @@ def __init__(self, uri="mongodb://127.0.0.1:27017", pool_size=1, ssl_context_fac assert isinstance(pool_size, int) assert pool_size >= 1 - if not uri.startswith("mongodb://"): + if not uri.startswith("mongodb://") and not uri.startswith("mongodb+srv://"): uri = "mongodb://" + uri self.__uri = parse_uri(uri)