Backwards

Use with Python

Make HTTP GET calls, manage errors and know API.


Basic examples:


#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
import requests
token="TOKEN"
testonoti="Notifica!"
requests.get('http://api.rpinotify.it/notification/{}/text/{}'.format(token, testonoti))
						


Variable explanation:

  • $token A personal token assigned during the registration process.
  • $testonoti Notification text.

Python library requests is requested.

Call structure - API

http://api.rpinotify.it/notification/$TOKEN/text/$TEXT

Variable name Description Format
$TOKEN Personal token. Alphanumeric string
$TEXT Notification text. Text

API - Advanced use


#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
import requests
token="TOKEN"
testonoti="Notifica!"
reponse = requests.get('http://api.rpinotify.it/notification/{}/text/{}'.format(token, testonoti))
  • reponse.status_code Answer status.
  • reponse.headers Answer Header.
  • reponse.content Call content.

API - Errors

'Error' string are in reponse.text.

  • InUrl parameters error Call structure not correct.
  • Token error Token not valid or digital signature void.
  • Database connection error Database error.
  • Database read error Database error.
  • SendNotifications bot (in server) error Notification sending impossible.
  • Database write error Database error.
  • No error Everything okay.
Service spammers will be automatically banned by RpiNotify.

RpiNotify is an Italian project supported by RaspberryItaly

The first Italian RaspberryPi community.