https://github.com/yeraydiazdiaz/wait_for_it.py
A pure Python implementation of wait-for-it.sh with no dependencies
https://github.com/yeraydiazdiaz/wait_for_it.py
Last synced: 26 days ago
JSON representation
A pure Python implementation of wait-for-it.sh with no dependencies
- Host: GitHub
- URL: https://github.com/yeraydiazdiaz/wait_for_it.py
- Owner: yeraydiazdiaz
- License: mit
- Created: 2019-04-21T11:41:47.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-05-17T07:45:54.000Z (about 4 years ago)
- Last Synced: 2025-01-10T15:07:23.795Z (5 months ago)
- Language: Python
- Size: 12.7 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# wait_for_it.py
[](https://travis-ci.org/yeraydiazdiaz/wait_for_it.py)
A pure Python implementation of [wait-for-it.sh](https://github.com/vishnubob/wait-for-it) with no dependencies, however if [requests](https://docs.python-requests.org) is available it will be used.
Intended to be used as a lightweight dependency service checker before startup of apps.
## Requirements
Python3+
## Usage
Copy and paste the script into your deployable and prepend the startup of your app with the check for a required service:
```
python wait_for_it.py http://localhost:1234 && start_my_app
```Optionally specify:
- `--timeout N` to wait N seconds before giving up, defaults to 5 seconds.
- `--retry N` to wait N seconds between attempts, defaults to 1 second.## Why?
I kept using variations of this script in Python Docker entry points and didn't want to pull external packages or copy some impossible to understand bash code, so I decided to write this fairly simple one that people can easily adapt if needed.
## Alternatives
- [`wait-for-it.sh`](https://github.com/vishnubob/wait-for-it) and some Bash magic
- [The `wait-for-it` package in PyPI](https://pypi.org/project/wait-for-it/)## License
MIT