I am using the latest version of Pymongo 4.3.3
and my connection string looks like below -
mongodb://userName:password@server:10255/?ssl=true&replicaSet=globaldb&retrywrites=false&maxIdleTimeMS=120000&socketTimeoutMS=360000&connectTimeoutMS=360000&appName=myAppName
I use this connection string to connect to the Azure Cosmos DB for MongoDB using the below code -
from pymongo import MongoClient
client = MongoClient(connString)
I intermittently see the error
InvalidURI: Invalid URI scheme: URI must begin with 'mongodb://' or 'mongodb+srv://'
I have tried import dns
but not sure how do I use it to resolve this error.
My connection string is correct and when I run it from my local it runs successfully. This intermittently fails when run from Azure Function App.
My requirements.txt
-
azure-functions
pymongo
pyodbc
dnspython
Can someone please help? Thank you!
Sanket Kelkar