Allow mock_s3 to use the standalone moto server
See original GitHub issueLong story short, I need to run the standalone moto server for pyspark to be able to access files, but I would like to use the same server for the internal calls happening on the python side using boto3.
The solution for changing the endpoint_url
per every Session created isn’t feasible for me and having to add a .boto
config file is also complicated as I don’t want to keep writing and erasing files and potentially have a broken env.
If boto were to implement something like this: https://github.com/boto/boto3/pull/2746 it would be very simple to setup the environment variable, but seems like they aren’t willing to.
Then another solution would seem the best which is allow mock_s3 (or any service mock) decorator to get a parameter and point to original mock server such as
@mock_s3(url='http://localhost:5000')
def test_foo(self):
s3 = boto3.client('s3')
s3.download_file(....)
Background info: https://github.com/spulec/moto/issues/1543 https://github.com/boto/boto3/issues/1375
Issue Analytics
- State:
- Created 2 years ago
- Comments:5
Our documentation is… a work in progress, let’s put it like that. 🙂 Let me know if you have any other questions. I’ll leave this issue open anyway as a reminder to myself to improve the docs in this area.
Seems like you have many hidden secrets! (Or I can’t read docs)
It appears to be working for the initial thing I’m trying. I will do further testing. Thank you