pymongo.errors.configurationError

The DNS Operation timed out after xxxxxx seconds. Followed all the steps in READ.ME but not able to resolve the errors. This happened when i did pytest -m connection Please help

Please check the connection string in .ini file. Also, don’t forget to whitelist the IP from atlas.

Kanika

Connection string is correct. Whitelisted the IP address too. But still I am getting error message.

Due to this I will not be able to complete my assignments on time. Whom should I contact to request for the extended time to submit assignments.?

Renuka

Are you working on your office system? Then firewall might be the issue.

Please share the contents of the .ini file and a screenshot of the error.

Unfortunately we cannot do that. But you can still access the course content or can register for the next offering which starts every Tuesday. :slight_smile: My suggestion would be register for the next offering after this issue is fixed.

Kanika

Kanika

Ticket: Connection

Rename this file to .ini after filling in your MFLIX_DB_URI and your SECRET_KEY

Do not surround the URI with quotes

[PROD]
SECRET_KEY = super_secret_key_you_should_change
MFLIX_DB_URI = mongodb+srv://m220student:m220password@mflix-nbiek.mongodb.net/test?retryWrites=true&w=majority
MFLIX_NS = sample_mflix

[TEST]
SECRET_KEY = super_secret_testing_key
MFLIX_DB_URI = mongodb+srv://m220student:m220password@mflix-nbiek.mongodb.net/test?retryWrites=true&w=majority
MFLIX_NS = sample_mflix

This is my .ini file. what should be the secret_key?. It is not mentioned anywhere in the course about secret key.

No. I am not using office system.

image

I can’t tell you… it’s secret :wink:

I was able to connect to your Atlas Cluster using the SRV connection strings you provided. Try and connect via a terminal:
mongo "mongodb+srv://m220student:m220password@mflix-nbiek.mongodb.net/test?retryWrites=true&w=majority"

As for the secret key, you can create one yourself. It’s not mandatory, it’s there for extra internal “security”.

Is it a kind of password ?. Please check my screen shot for the error message I am getting.

But I am not able to connect. You could have seen my error messages for test

Yes, you can see it as some kind of password.

The error I’m seeing is when you run it through pytest. Because it’s a DNS error, what I’m asking you to try is to connect to your Atlas Cluster using the mongo shell:

  1. Open command prompt or your OS terminal
  2. Paste and run the following:
    mongo "mongodb+srv://m220student:m220password@mflix-nbiek.mongodb.net/test?retryWrites=true&w=majority"

What is the result?

1 Like

image

Your connection from shell seems to be ok
Are you able to run from your config file?
Did you get details on generating secret_key
Please check this link

Where to take value for SECRET_KEY?