notehub (18 January 2014) | index /home/sean/projects/notehub/notehub.py |
A simple wrapper for the Notehub.org api.
A wrapper for the Notehub.org api that simplifies much of the work needed to
make a call. The wrapper handles the work of adding necessary parameters,
hashing passwords, generating signatures, encoding the data and checking
response codes.
*************************************************************
***You will need a PID and PSK from http://notehub.org/api***
***in order to use the create_note and update_note methods.**
*************************************************************
Example use:
from notehub import Notehub
from notehub import NotehubError
PID = 'example_pid' # Replace with your PID
PSK = 'example_psk' # Replace with your PSK
nh = Notehub(PID, PSK)
# get_note
try:
note = nh.get_note('2014 1 26 test')
print(note)
except NotehubError as e:
print(e)
# create_note
note_text = 'Test note 123.'
try:
note = nh.create_note(note_text)
print(note)
except NotehubError as e:
print(e)
# create_note with password
note_text = 'Test note 123.'
password = 'abc123'
try:
note = nh.create_note(note_text, password=password)
print(note)
except NotehubError as e:
print(e)
# create_note with specific theme and fonts
note_text = 'Test note 123.'
theme = 'solarized-light'
text_font = 'Alegreya Sans SC'
header_font = 'Chau Philomene One'
try:
note = nh.create_note(note_text, theme=theme, text_font=text_font,
header_font=header_font)
print(note)
except NotehubError as e:
print(e)
# update_note
note_id = '2014 1 26 test-note-123-1'
new_note_text = 'Test note 123.'
password = 'abc123'
try:
note = nh.update_note(note_id, new_note_text, password)
print(note)
except NotehubError as e:
print(e)
Modules | ||||||
|
Classes | ||||||||||||||||||
|
Functions | ||
Author | ||
Sean Watson |