Multiple proxy setup

Hey guys, I have the following challenge to solve. I work for a big corporate. when I do remote work I have two proxy server running. I also have an additional container running to make tunnel connection to my mongodb databse in the cloud. I can connect via the Compass App Cli to my database. Now i wanna achieve the same with my python code to manipulate the data. But I found poor documentation on how to do it when you 1+ proxy running. Do you guys maybe face a similiar challenge or have recommendations where to look at to solve this challenge ?

Hey @Eike_Struckmeier - welcome to the MongoDB community!

I guess I’m struggling to understand exactly what your issue is - if you can connect with a connection string in Compass, that connection string should also work from your Python code.

Can you give me a better idea of (a) what’s different between where Compass is running and where your Python code is running, and (b) what error you’re seeing in your Python code. The more detail you can provide the better.

Mark

I get a timeout since the database is not reachable.

It has something to do with socks5 proxy i have to use to make my tunnel connection with ssh.

Dealing with proxies and remote setups can definitely be a maze sometimes. When I had to connect python scriptes to databases through multiproxies, it was really difficult

Dealing with proxies and remote setups can definitely be a maze sometimes. When I had to connect python scriptes to databases through multiproxies, it was really difficult

One thing that might help is ensuring your Python environment is set up to handle proxy chains correctly. Sometimes libraries like requests or pymongo can be configured to pass through multiple proxies. As for rotating proxies, services like Proxy Rotator can be a lifesaver for tasks needing frequent IP changes, like data scraping or managing multiple connections securely.

Just be mindful of your corporate policies on proxy usage. I once struggled with a similar setup where I needed to script connections through layers of proxies for a project. It took a bit of trial and error with library configurations, but once everything clicked, it was smooth sailing.