The Bloodbath Python library provides convenient access to the Bloodbath API from applications written in the Python language.
You don't need this source code unless you want to modify the package. If you just want to use the package, just run:
pip install --upgrade bloodbath
Install from source with:
python setup.py install
The library needs to be configured with your account's secret key which is
available in your Bloodbath Dashboard. Set bloodbath.api_key
to its
value:
import bloodbath
bloodbath.api_key = "NTI6PASMD9BQhYtRh..."
# list events
events = bloodbath.Event.list()
# find an event
event = bloodbath.Event.find("b7ccff...")
# schedule an event
event = bloodbath.Event.schedule(
scheduled_for=(datetime.datetime.now() + datetime.timedelta(hours=1)).isoformat(),
headers="{}",
method="post",
body="some body content",
endpoint='https://api.acme.com/path'
)
# cancel an event
bloodbath.Event.cancel("b7ccff...")
# print that event's id
print(event.id)
For more documentation about how to use Bloodbath, don't hesitate to check Bloodbath Docs.
Run all tests:
$ python setup.py pytest