diff --git a/.gitignore b/.gitignore deleted file mode 100644 index cfadd8d..0000000 --- a/.gitignore +++ /dev/null @@ -1,39 +0,0 @@ -*.py[co] - -#small test code that contains my keys -t.py - -# Packages -*.egg -*.egg-info -dist -build -eggs -parts -bin -include -lib -local -var -sdist -develop-eggs -.installed.cfg - -# Installer logs -pip-log.txt - -# Unit test / coverage reports -.coverage -.tox - -# PyCharm data -.idea - -#Translations -*.mo - -#Mr Developer -.mr.developer.cfg - -#Environment -env diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4348b43..0000000 --- a/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -language: python -sudo: false -python: - - "2.7" - - "3.5" - -install: - - travis_retry pip install . - - pip install -r requirements.txt - -script: - - make test \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 478c020..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,34 +0,0 @@ -## Change Log - -### v1.2 (2021/5/17) -- Added Microsoft Teams - -### v1.1 (2020/2/17) -- Fixed the ordering of the message_subject argument for the incident/maintenance methods which was breaking backwards compatibility - -### v1.0 (2020/2/14) -- Change silent param for subscriber/add to a string (@incarnate) - -### v0.9 (2020/2/10) -- Added message_subject to the maintenance schedule, start, update and finish methods -- Adding message_subject to the incident create, update and resolve (@cfrancocapo) - -### v0.8 (2018/11/28) -- Changed variables to proper type (int->str) - -### v0.7 (2018/2/10) -- Change /component/status/update to use a single component -- Support retrieving single incident/maintenance events -- New incident/maintenance methods to fetch list of IDs - -### v0.6 (2017/12/20) -- Updated for incident/create infrastructure_affected - -### v0.5 (2017/12/14) -- Updated for maintenance/schedule infrastructure_affected - -### v0.4 (2017/1/26) -- Fixed error messages - -### v0.3 (2016/1/7) -- Initial release diff --git a/Makefile b/Makefile deleted file mode 100644 index 0d068f3..0000000 --- a/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -help: - @echo " env create a development environment using virtualenv" - @echo " deps install dependencies" - @echo " clean remove unwanted stuff" - @echo " test run tests" - -env: - sudo easy_install pip && \ - pip install virtualenv && \ - virtualenv env && \ - . env/bin/activate && \ - make deps - -deps: - pip install -r requirements.txt --use-mirrors - -clean: - rm -fr build - rm -fr dist - find . -name '*.pyc' -exec rm -f {} \; - find . -name '*.pyo' -exec rm -f {} \; - find . -name '*~' -exec rm -f {} \; - -test: - nosetests - -build: clean - python setup.py sdist - python setup.py bdist_wheel - -upload: clean - python setup.py sdist upload - python setup.py bdist_wheel upload diff --git a/PKG-INFO b/PKG-INFO new file mode 100644 index 0000000..137c0d8 --- /dev/null +++ b/PKG-INFO @@ -0,0 +1,76 @@ +Metadata-Version: 1.1 +Name: statusio-python +Version: 1.2 +Summary: A Python wrapper around the Status.io API +Home-page: https://github.com/statusio/statusio-python +Author: Status.io +Author-email: hello@status.io +License: Apache License 2.0 +Description: Python Status.io + ================ + + A Python wrapper around the Status.io API. + + |Downloads| + + Introduction + ------------ + + This library provides a pure Python interface for the `Status.io + API `__. It works with Python versions + from 2.6+. + + `Status.io `__ provides hosted system status pages. + + Installing + ---------- + + You can install statusio-python using:: + + $ pip install statusio-python + + Documentation + ------------- + + View the last release API documentation at: + http://developers.status.io + + Using + ----- + + The library provides a Python wrapper around the Status.io API. + + API + ~~~ + + The API is exposed via the ``statusio.Api`` class. + + To create an instance of the ``statusio.Api`` with yout credentials: + + >>> import statusio + >>> api = statusio.Api(api_id='api_id', + api_key='api_key') + + To retrieve your status page summary: + + >>> summary = api.StatusSummary('status_page_id') + >>> print(summary) + + View the full API documentation:: + + $ pydoc statusio.Api + + .. |Downloads| image:: https://img.shields.io/pypi/v/statusio-python.svg + :target: https://pypi.python.org/pypi/statusio-python/ + +Keywords: status.io api statusio +Platform: UNKNOWN +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: Apache Software License +Classifier: Operating System :: OS Independent +Classifier: Topic :: Software Development :: Libraries :: Python Modules +Classifier: Topic :: Internet +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 2 +Classifier: Programming Language :: Python :: 2.7 diff --git a/README.md b/README.md deleted file mode 100644 index 549db08..0000000 --- a/README.md +++ /dev/null @@ -1,31 +0,0 @@ -# Python Status.io - -Python package for [Status.io](https://status.io) - -[![Downloads](https://img.shields.io/pypi/v/statusio-python.svg)](https://pypi.python.org/pypi/statusio-python/) - - -This library provides a pure Python interface for the [Status.io API](http://developers.status.io/). It works with Python versions from 2.6+. - - -## Installation - - - $ pip install statusio-python - -## Usage - -```python -import statusio -api = statusio.Api(api_id='api_id', api_key='api_key') -``` - - -Retrieve status page summary: - -```python -summary = api.StatusSummary('status_page_id') -print(summary) -``` - -View the full API documentation at: http://developers.status.io/ diff --git a/python-statusio.spec b/python-statusio.spec deleted file mode 100644 index 3c145d4..0000000 --- a/python-statusio.spec +++ /dev/null @@ -1,48 +0,0 @@ -%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} - -Name: statusio-python -Version: 1.2 -Release: %{?dist} -Summary: Python Interface for Status.io API - -Group: Development/Libraries -License: Apache License 2.0 -URL: http://github.com/statusio/statusio-python -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) - -BuildArch: noarch -Requires: python >= 2.6, -BuildRequires: python-setuptools - - -%description -This library provides a pure python interface for the Status.io API. - - -%prep -%setup -q - - -%build -%{__python} setup.py build - - -%install -rm -rf $RPM_BUILD_ROOT -chmod a-x README -%{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT - - -%clean -rm -rf $RPM_BUILD_ROOT - - -%files -%defattr(-,root,root,-) -%doc README.rst -# For noarch packages: sitelib -%{python_sitelib}/* - - -%changelog -- Initial package. \ No newline at end of file diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 9e9b9c7..0000000 --- a/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -future -requests \ No newline at end of file diff --git a/setup.cfg b/setup.cfg index 957d9cd..81b1314 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,7 +1,12 @@ [check-manifest] -ignore = - .travis.yml - violations.flake8.txt +ignore = + .travis.yml + violations.flake8.txt [flake8] -ignore = E111,E124,E126,E201,E202,E221,E241,E302,E501 \ No newline at end of file +ignore = E111,E124,E126,E201,E202,E221,E241,E302,E501 + +[egg_info] +tag_build = +tag_date = 0 + diff --git a/statusio_python.egg-info/PKG-INFO b/statusio_python.egg-info/PKG-INFO new file mode 100644 index 0000000..137c0d8 --- /dev/null +++ b/statusio_python.egg-info/PKG-INFO @@ -0,0 +1,76 @@ +Metadata-Version: 1.1 +Name: statusio-python +Version: 1.2 +Summary: A Python wrapper around the Status.io API +Home-page: https://github.com/statusio/statusio-python +Author: Status.io +Author-email: hello@status.io +License: Apache License 2.0 +Description: Python Status.io + ================ + + A Python wrapper around the Status.io API. + + |Downloads| + + Introduction + ------------ + + This library provides a pure Python interface for the `Status.io + API `__. It works with Python versions + from 2.6+. + + `Status.io `__ provides hosted system status pages. + + Installing + ---------- + + You can install statusio-python using:: + + $ pip install statusio-python + + Documentation + ------------- + + View the last release API documentation at: + http://developers.status.io + + Using + ----- + + The library provides a Python wrapper around the Status.io API. + + API + ~~~ + + The API is exposed via the ``statusio.Api`` class. + + To create an instance of the ``statusio.Api`` with yout credentials: + + >>> import statusio + >>> api = statusio.Api(api_id='api_id', + api_key='api_key') + + To retrieve your status page summary: + + >>> summary = api.StatusSummary('status_page_id') + >>> print(summary) + + View the full API documentation:: + + $ pydoc statusio.Api + + .. |Downloads| image:: https://img.shields.io/pypi/v/statusio-python.svg + :target: https://pypi.python.org/pypi/statusio-python/ + +Keywords: status.io api statusio +Platform: UNKNOWN +Classifier: Development Status :: 5 - Production/Stable +Classifier: Intended Audience :: Developers +Classifier: License :: OSI Approved :: Apache Software License +Classifier: Operating System :: OS Independent +Classifier: Topic :: Software Development :: Libraries :: Python Modules +Classifier: Topic :: Internet +Classifier: Programming Language :: Python +Classifier: Programming Language :: Python :: 2 +Classifier: Programming Language :: Python :: 2.7 diff --git a/statusio_python.egg-info/SOURCES.txt b/statusio_python.egg-info/SOURCES.txt new file mode 100644 index 0000000..3bb3211 --- /dev/null +++ b/statusio_python.egg-info/SOURCES.txt @@ -0,0 +1,10 @@ +README.rst +setup.cfg +setup.py +statusio/__init__.py +statusio/api.py +statusio_python.egg-info/PKG-INFO +statusio_python.egg-info/SOURCES.txt +statusio_python.egg-info/dependency_links.txt +statusio_python.egg-info/requires.txt +statusio_python.egg-info/top_level.txt \ No newline at end of file diff --git a/statusio_python.egg-info/dependency_links.txt b/statusio_python.egg-info/dependency_links.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/statusio_python.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/statusio_python.egg-info/requires.txt b/statusio_python.egg-info/requires.txt new file mode 100644 index 0000000..f38dacc --- /dev/null +++ b/statusio_python.egg-info/requires.txt @@ -0,0 +1,2 @@ +future +requests diff --git a/statusio_python.egg-info/top_level.txt b/statusio_python.egg-info/top_level.txt new file mode 100644 index 0000000..52d3b6c --- /dev/null +++ b/statusio_python.egg-info/top_level.txt @@ -0,0 +1 @@ +statusio diff --git a/test.py b/test.py deleted file mode 100644 index 4ef1aac..0000000 --- a/test.py +++ /dev/null @@ -1,5 +0,0 @@ -import unittest - -if __name__ == '__main__': - testsuite = unittest.TestLoader().discover('.') - unittest.TextTestRunner(verbosity=1).run(testsuite) \ No newline at end of file diff --git a/tests/__init__.py b/tests/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/tests/test_api.py b/tests/test_api.py deleted file mode 100644 index e5ed13e..0000000 --- a/tests/test_api.py +++ /dev/null @@ -1,339 +0,0 @@ -# encoding: utf-8 - -import os -import time -import unittest -import statusio - -API_ID = '' -API_KEY = '' -STATUSPAGE_ID = '568d8a3e3cada8c2490000dd' -COMPONENT = '568d8a3e3cada8c2490000ed' -CONTAINER = '568d8a3e3cada8c2490000ec' -COMPONENT_CONTAINER_COMBO = ['568d8a3e3cada8c2490000ed-568d8a3e3cada8c2490000ec'] -METRIC_ID = '568d8ab5efe35d412f0006f8' - -ID1 = '' -ID2 = '' - - -class ApiTest(unittest.TestCase): - - def setUp(self): - self._api = statusio.Api(API_ID, API_KEY) - - # STATUS - - def testStatus1Summary(self): - # Test the statusio.StatusSummary method - print('Testing StatusSummary') - data = self._api.StatusSummary(STATUSPAGE_ID) - self.assertEqual(data['status']['error'], 'no') - - # SUBSCRIBER - - def testSubscriber1Add(self): - # Test the statusio.SubscriberAdd method - print('Testing SubscriberAdd') - global ID1, ID2 - data = self._api.SubscriberAdd( - STATUSPAGE_ID, "email", "test@example.com") - self.assertEqual(data['status']['error'], 'no') - ID1 = data['subscriber_id'] - print(data['subscriber_id']) - print(ID1) - - def testSubscriber2List(self): - # Test the statusio.SubscriberList method - print('Testing SubscriberList') - global ID1, ID2 - data = self._api.SubscriberList(STATUSPAGE_ID) - self.assertEqual(data['status']['error'], 'no') - self.assertEqual(data['result']['email'][0]['_id'], ID1) - - def testSubscriber3Update(self): - # Test the statusio.SubscriberUpdate method - print('Testing SubscriberUpdate') - global ID1, ID2 - data = self._api.SubscriberUpdate( - STATUSPAGE_ID, ID1, "test@example.com") - self.assertEqual(data['status']['error'], 'no') - - def testSubscriber4Remove(self): - # Test the statusio.SubscriberRemove method - print('Testing SubscriberRemove') - global ID1, ID2 - data = self._api.SubscriberRemove(STATUSPAGE_ID, ID1) - self.assertEqual(data['status']['error'], 'no') - - # MAINTENANCE - - def testMaintenance1Schedule(self): - # Test the statusio.MaintenanceSchedule method - print('Testing MaintenanceSchedule') - global ID1, ID2 - data = self._api.MaintenanceSchedule( - STATUSPAGE_ID, - COMPONENT_CONTAINER_COMBO, - 'Autotest', - 'Autotest Description', - '2018/12/31', - '23:59', - '2019/01/01', - '23:59') - self.assertEqual(data['status']['error'], 'no') - ID1 = data['result'] - - def testMaintenance2List(self): - # Test the statusio.MaintenanceList method - print('Testing MaintenanceList') - global ID1, ID2 - data = self._api.MaintenanceList(STATUSPAGE_ID) - self.assertEqual(data['status']['error'], 'no') - self.assertEqual( - data['result']['upcoming_maintenances'][0]['_id'], ID1) - ID2 = data['result']['upcoming_maintenances'][0]['messages'][0]['_id'] - - def testMaintenance3Message(self): - # Test the statusio.MaintenanceMessage method - print('Testing MaintenanceMessage') - global ID1, ID2 - data = self._api.MaintenanceMessage(STATUSPAGE_ID, ID2) - self.assertEqual(data['status']['error'], 'no') - - def testMaintenance4Start(self): - # Test the statusio.MaintenanceStart method - print('Testing MaintenanceStart') - global ID1, ID2 - data = self._api.MaintenanceStart( - STATUSPAGE_ID, ID1, 'Autotest details') - self.assertEqual(data['status']['error'], 'no') - - def testMaintenance5Update(self): - # Test the statusio.MaintenanceUpdate method - print('Testing MaintenanceUpdate') - global ID1, ID2 - data = self._api.MaintenanceUpdate( - STATUSPAGE_ID, ID1, 'Autotest details update') - self.assertEqual(data['status']['error'], 'no') - - def testMaintenance7Finish(self): - # Test the statusio.MaintenanceFinish method - print('Testing MaintenanceFinish') - global ID1, ID2 - data = self._api.MaintenanceFinish( - STATUSPAGE_ID, ID1, 'Autotest details finish') - self.assertEqual(data['status']['error'], 'no') - - def testMaintenance8Delete(self): - # Test the statusio.MaintenanceDelete method - print('Testing MaintenanceDelete') - global ID1, ID2 - data = self._api.MaintenanceDelete(STATUSPAGE_ID, ID1) - self.assertEqual(data['status']['error'], 'no') - - # INCIDENT - - def testIncident1Create(self): - # Test the statusio.IncidentCreate method - print('Testing IncidentCreate') - global ID1, ID2 - data = self._api.IncidentCreate( - STATUSPAGE_ID, - COMPONENT_CONTAINER_COMBO, - 'Autotest', - 'Autotest details', - 300, - 100) - self.assertEqual(data['status']['error'], 'no') - ID1 = data['result'] - - def testIncident2List(self): - # Test the statusio.IncidentList method - print('Testing IncidentList') - global ID1, ID2 - data = self._api.IncidentList(STATUSPAGE_ID) - self.assertEqual(data['status']['error'], 'no') - self.assertEqual(data['result']['active_incidents'][0]['_id'], ID1) - ID2 = data['result']['active_incidents'][0]['messages'][0]['_id'] - - def testIncident3Message(self): - # Test the statusio.IncidentMessage method - print('Testing IncidentMessage') - global ID1, ID2 - data = self._api.IncidentMessage(STATUSPAGE_ID, ID2) - self.assertEqual(data['status']['error'], 'no') - - def testIncident5Update(self): - # Test the statusio.IncidentUpdate method - print('Testing IncidentUpdate') - global ID1, ID2 - data = self._api.IncidentUpdate( - STATUSPAGE_ID, ID1, 'Autotest details update', 300, 100) - self.assertEqual(data['status']['error'], 'no') - - def testIncident7Resolve(self): - # Test the statusio.IncidentResolve method - print('Testing IncidentResolve') - global ID1, ID2 - data = self._api.IncidentResolve( - STATUSPAGE_ID, ID1, 'Autotest details resolve', 300, 100) - self.assertEqual(data['status']['error'], 'no') - - def testIncident8Delete(self): - # Test the statusio.IncidentDelete method - print('Testing IncidentDelete') - global ID1, ID2 - data = self._api.IncidentDelete(STATUSPAGE_ID, ID1) - self.assertEqual(data['status']['error'], 'no') - - # METRIC - - def testMetric1Update(self): - # Test the statusio.MetricUpdate method - print('Testing MetricUpdate') - global ID1, ID2 - data = self._api.MetricUpdate(STATUSPAGE_ID, - METRIC_ID, - 20.69, - 1395981878000, - ["2014-03-28T05:43:00+00:00", - "2014-03-28T06:43:00+00:00", - "2014-03-28T07:43:00+00:00", - "2014-03-28T08:43:00+00:00", - "2014-03-28T09:43:00+00:00", - "2014-03-28T10:43:00+00:00", - "2014-03-28T11:43:00+00:00", - "2014-03-28T12:43:00+00:00", - "2014-03-28T13:43:00+00:00", - "2014-03-28T14:43:00+00:00", - "2014-03-28T15:43:00+00:00", - "2014-03-28T16:43:00+00:00", - "2014-03-28T17:43:00+00:00", - "2014-03-28T18:43:00+00:00", - "2014-03-28T19:43:00+00:00", - "2014-03-28T20:43:00+00:00", - "2014-03-28T21:43:00+00:00", - "2014-03-28T22:43:00+00:00", - "2014-03-28T23:43:00+00:00", - "2014-03-29T00:43:00+00:00", - "2014-03-29T01:43:00+00:00", - "2014-03-29T02:43:00+00:00", - "2014-03-29T03:43:00+00:00"], - [20.70, - 20.00, - 19.20, - 19.80, - 19.90, - 20.10, - 21.40, - 23.00, - 27.40, - 28.70, - 27.50, - 29.30, - 28.50, - 27.20, - 28.60, - 28.70, - 25.90, - 23.40, - 22.40, - 21.40, - 19.80, - 19.50, - 20.00], - 20.07, - 1395463478000, - ["2014-03-22T04:43:00+00:00", - "2014-03-23T04:43:00+00:00", - "2014-03-24T04:43:00+00:00", - "2014-03-25T04:43:00+00:00", - "2014-03-26T04:43:00+00:00", - "2014-03-27T04:43:00+00:00", - "2014-03-28T04:43:00+00:00"], - [23.10, - 22.10, - 22.20, - 22.30, - 22.10, - 18.70, - 17.00], - 10.63, - 1393476280000, - ["2014-02-28T04:43:00+00:00", - "2014-03-01T04:43:00+00:00", - "2014-03-02T04:43:00+00:00", - "2014-03-03T04:43:00+00:00", - "2014-03-04T04:43:00+00:00", - "2014-03-05T04:43:00+00:00", - "2014-03-06T04:43:00+00:00", - "2014-03-07T04:43:00+00:00", - "2014-03-08T04:43:00+00:00", - "2014-03-09T04:43:00+00:00", - "2014-03-10T04:43:00+00:00", - "2014-03-11T04:43:00+00:00", - "2014-03-12T04:43:00+00:00", - "2014-03-13T04:43:00+00:00", - "2014-03-14T04:43:00+00:00", - "2014-03-15T04:43:00+00:00", - "2014-03-16T04:43:00+00:00", - "2014-03-17T04:43:00+00:00", - "2014-03-18T04:43:00+00:00", - "2014-03-19T04:43:00+00:00", - "2014-03-20T04:43:00+00:00", - "2014-03-21T04:43:00+00:00", - "2014-03-22T04:43:00+00:00", - "2014-03-23T04:43:00+00:00", - "2014-03-24T04:43:00+00:00", - "2014-03-25T04:43:00+00:00", - "2014-03-26T04:43:00+00:00", - "2014-03-27T04:43:00+00:00", - "2014-03-28T04:43:00+00:00"], - [0.00, - 0.00, - 0.00, - 0.00, - 0.00, - 0.00, - 0.00, - 0.00, - 0.00, - 0.00, - 0.00, - 0.00, - 18.50, - 18.60, - 18.40, - 16.60, - 16.80, - 17.90, - 19.90, - 21.30, - 22.80, - 20.00, - 17.30, - 19.10, - 21.50, - 22.40, - 22.50, - 22.00, - 21.80]) - self.assertEqual(data['status']['error'], 'no') - - # COMPONENT - - def testComponent1List(self): - # Test the statusio.ComponentList method - print('Testing ComponentList') - global ID1, ID2 - data = self._api.ComponentList(STATUSPAGE_ID) - self.assertEqual(data['status']['error'], 'no') - - def testComponent2StatusUpdate(self): - # Test the statusio.ComponentStatusUpdate method - print('Testing ComponentStatusUpdate') - global ID1, ID2 - data = self._api.ComponentStatusUpdate( - STATUSPAGE_ID, COMPONENT, CONTAINER, 'Test status', 300) - self.assertEqual(data['status']['error'], 'no')