codebradley / python-uptimerobot Goto Github PK
View Code? Open in Web Editor NEWpython-uptimerobot is an Uptime Robot http://uptimerobot.com integration for your Python project.
License: MIT License
python-uptimerobot is an Uptime Robot http://uptimerobot.com integration for your Python project.
License: MIT License
According to https://uptimerobot.com/apiv1 the version 1 of the API was retired on 1 Jan 2017.
alert_contact.py
from future import absolute_import, division, print_function, unicode_literals
from termcolor import colored
class AlertContact(object):
class Type:
SMS = 1
EMAIL = 2
TWITTER = 3
BOXCAR = 4
PUSHBULLET = 6
WEBHOOK = 5
TYPES = {
Type.SMS: "sms",
Type.EMAIL: "email",
Type.TWITTER: "twitter",
Type.BOXCAR: "boxcar",
Type.PUSHBULLET: "pushbullet",
Type.WEBHOOK: "webhook",
}
I'm extending your code to include some additional API functions and this method was returning None. The problem is that if UptimeRobot returns stat:'fail' then the method doesn't return. This is because stat does exist, but the value is not 'ok'. I believe I fixed this issue by updating the code to:
def requestApi(self, url):
response = urllib_request.urlopen(url)
content = response.read().decode('utf-8')
jContent = json.loads(content)
if jContent.get('stat'):
stat = jContent.get('stat')
if stat == "ok":
return True, jContent
return False, jContent
To allow easy install for end users, the package should be listed on PyPi.
Some errors occur on import (Python3.4):
from uptimerobot.uptimerobot import UptimeRobot
File "~/Code/src/uptimerobot/uptimerobot/uptimerobot.py", line 103
except Exception, e:
^
SyntaxError: invalid syntax
Hi @CodeBradley
I'm happy that you continue the development of python-uptimerobot and maintain the package.
We should transfer the project on the Python Package Index as well - otherwise you cannot push new releases to the PyPI. Could you please give me your username? Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.