-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from ambitioninc/develop
v0.1
- Loading branch information
Showing
21 changed files
with
625 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
include README.rst | ||
include CONTRIBUTORS | ||
include LICENSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,27 @@ | ||
pagerduty-api Documentation | ||
============================= | ||
Please put a description here, followed by sections for configuration, basic usage, and code documentation. | ||
Introduction | ||
============ | ||
pagerduty-api is a package for easily interacting with PagerDuty's API. | ||
|
||
Why? | ||
---- | ||
|
||
There are several other libraries interacting with the PagerDuty API, however none of them include | ||
tests and documentation. | ||
|
||
Installation | ||
------------ | ||
|
||
To install the latest release, type:: | ||
|
||
pip install pagerduty-api | ||
|
||
To install the latest code directly from source, type:: | ||
|
||
pip install git+git://github.com/ambitioninc/pagerduty-api.git | ||
|
||
|
||
Requirements | ||
------------ | ||
|
||
* Python 2.7, 3.3, 3,4 | ||
* requests >= 2.0.0 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Internal Resources | ||
================== | ||
|
||
ConfigurationException | ||
---------------------- | ||
|
||
.. automodule:: pagerduty_api.exceptions | ||
.. autoclass:: pagerduty_api.exceptions.ConfigurationException | ||
|
||
IncidentKeyException | ||
-------------------- | ||
|
||
.. autoclass:: pagerduty_api.exceptions.IncidentKeyException | ||
|
||
Resource | ||
-------- | ||
|
||
.. automodule:: pagerduty_api.base | ||
.. autoclass:: pagerduty_api.base.Resource | ||
:members: | ||
|
||
.. automethod:: __init__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
.. _ref-pagerduty_api: | ||
.. _ref-code-documentation: | ||
|
||
Code documentation | ||
Code Documentation | ||
================== | ||
|
||
pagerduty_api | ||
------------------ | ||
Alert | ||
----- | ||
|
||
.. automodule:: pagerduty_api | ||
.. autoclass:: pagerduty_api.pagerduty_api | ||
.. autoclass:: pagerduty_api.Alert | ||
:members: | ||
|
||
.. automethod:: __init__ | ||
.. automethod:: __init__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
Usage | ||
===== | ||
|
||
Configuring Alerts | ||
------------------ | ||
Alerts has an environment variable will need to configure before using. | ||
|
||
PAGERDUTY_API_KEY | ||
~~~~~~~~~~~~~~~~~ | ||
|
||
This is the API access key for authenticating to PagerDuty. This defaults to | ||
the environment variable ``PAGERDUTY_API_KEY`` if it is present. See | ||
`PagerDuty's docs on authentication`_ for more information. | ||
|
||
.. _PagerDuty's docs on authentication: http://developer.pagerduty.com/documentation/rest/authentication | ||
|
||
.. code-block:: bash | ||
$ export PAGERDUTY_API_KEY="wieZvi9AY3uCj6zaQPZX" | ||
Using Alerts | ||
------------ | ||
``pagerduty_api`` comes with an interface for PagerDuty called ``Alert``. All an | ||
alert needs to be instantiated is a ``service_key``. This Service API Key is a | ||
unique ID generated in PagerDuty for a Generic API Service. | ||
|
||
.. code-block:: python | ||
from pagerduty_api import Alert | ||
alert = Alert(service_key='4baa5d20cfba466a5e075b02698f455c') | ||
Trigger Alert | ||
~~~~~~~~~~~~~ | ||
To trigger an alert, use ``.trigger()`` on the interface. If you don't pass in an | ||
incident_key, one will be computed as the md5 hash of the description | ||
|
||
.. code-block:: python | ||
from pagerduty_api import Alert | ||
alert = Alert(service_key='4baa5d20cfba466a5e075b02698f455c') | ||
alert.trigger( | ||
description='No data received', | ||
client='My Client', | ||
client_url='http://mysite.com', | ||
details={'some_key': 'some_value'} | ||
) | ||
Acknowledge Alert | ||
~~~~~~~~~~~~~~~~~ | ||
To acknowledge an alert, use ``.acknowledge()`` on the interface. If you created | ||
this alert with ``.trigger()``, you won't need to provide an ``incident_key``. | ||
|
||
.. code-block:: python | ||
from pagerduty_api import Alert | ||
alert = Alert(service_key='4baa5d20cfba466a5e075b02698f455c') | ||
alert.acknowledge( | ||
incident_key='0ace123ba99999160f35ea3bd381a318', | ||
description='Working on it.', | ||
details={'some_key': 'some_value'} | ||
) | ||
Resolve Alert | ||
~~~~~~~~~~~~~ | ||
To resolve an alert, use ``.resolve()`` on the interface. If you created | ||
this alert with ``.trigger()``, you won't need to provide an ``incident_key``. | ||
|
||
.. code-block:: python | ||
from pagerduty_api import Alert | ||
alert = Alert(service_key='4baa5d20cfba466a5e075b02698f455c') | ||
alert.resolve( | ||
incident_key='0ace123ba99999160f35ea3bd381a318', | ||
description='Fixed it.', | ||
details={'some_key': 'some_value'} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# flake8: noqa | ||
from .alerts import Alert |
Oops, something went wrong.