Inspired by opsgenie
OpsGenie Python SDK aims to access OpsGenie Web API through HTTP calls from a client application in Python language.
OpsGenie Python SDK covers:
- Alert API (Under development)
- Account API (Under development)
- User API (Under development)
- Team API (Under development)
- The API is specifically built for Python 2.7 but can also be used with other Python versions.
- Before you begin, you need to sign up OpsGenie if you don't have a valid account yet. Create an API Integration and get your API key.
To download all packages in the repo with their dependencies, simply execute
pip install https://github.com/kumarappan-arumugam/opsgenie-py/archive/master.zip
One can start using OpsGenie Python SDK by initializing client and making a request. Example shown below demonstrates how to initialize our client and make a create alert request.
from opsgenie import OpsGenie
from opsgenie import Configuration
from opsgenie import CreateAlertRequest
config = Configuration(apikey="YOUR_API_KEY", endpoint="OPTIONAL") # default endpoint is api.opsgenie.com
client = OpsGenie(config)
alert_request = CreateAlertRequest(
message = "An example alert message",
alias = "",
description = "Every alert needs a description",
responders = [
{"name":"Example", "type":"team"},
{"username":"example@example.com", "type":"user"},
{"name":"Example Escalation", "type":"escalation"},
{"name":"Example Schedule", "type":"schedule"}
],
visibleTo = [
{"name":"Example","type":"team"},
{"username":"example@example.com","type":"user"}
],
actions = ["Restart", "AnExampleAction"],
tags = ["Example","Environment"],
details = {"key1":"value1","key2":"value2"},
entity = "An example entity",
priority = "P1"
)
client.alert.create_alert(alert_request)
Please follow the links below for more information and details about the Web API.
If you like to report a bug, or a feature request; please create a github issue.