question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support the ability to start/stop moto server mode through code

See original GitHub issue

Feature Request: Make the server module into a package that can be importable and controlled directly.

Use Case: Spinning up 2 different mock_s3 instances. One with the default aws address and one with a custom DNS endpoint_url passed into boto3.

I have only been able to run 2 separate mocks of the same service via the standalone server with different ports. It would be helpful if moto had a way to programmatically start/stop the standalone server mode natively with python. Currently the only way I have nicely been able to accomplish this is by starting the server in a subprocess.

def _moto_server_process(service, host, port):
    cmd = ['moto_server', service, '-p', str(port), '-H', host]
    return subprocess.Popen(cmd, stdout=subprocess.PIPE,
                            stderr=subprocess.STDOUT)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
thehesiodcommented, Aug 16, 2017
0reactions
bblommerscommented, Mar 5, 2022

Moto 3.0.6 now includes a way to start the MotoServer programmatically. See the documentation here: http://docs.getmoto.org/en/latest/docs/server_mode.html#start-within-python

It is still in beta while we collect feedback, so if you find any bugs or improvements, feel free to open a new issue!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Non-Python SDK's / Server Mode - Moto: Mock AWS Services
Moto has a stand-alone server mode. This allows you to use Moto with any of the official AWS SDK's. Installation . Install...
Read more >
ESP8266 Relay Module - Control AC Appliances (Web Server)
Learn how to use Relay Module with ESP8266 NodeMCU to control AC household appliances using Arduino IDE. You'll also build a web server...
Read more >
How can I programmatically stop/start a windows service on a ...
I have this coded in my project but I have been running in debug mode stepping through it to find why it won't...
Read more >
Moto Documentation - Read the Docs
See Non-Python SDK's / Server Mode for more information. ... of docker-compose configuration that runs Moto server in a separate service.
Read more >
WT4070/90 Wearable Terminal User Guide | VisionID
network without written permission from Motorola. ... Scanning Bar Codes . ... not in suspend mode, press the Power button to place the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found