~jonobacon/python-snippets/trunk

23 by Jono Bacon
Added Gwibber API example.
1
#!/usr/bin/env python
2
#
3
# [SNIPPET_NAME: Send a message]
4
# [SNIPPET_CATEGORIES: Gwibber]
5
# [SNIPPET_DESCRIPTION: Send a message using the Gwibber API]
6
# [SNIPPET_AUTHOR: Jono Bacon <jono@ubuntu.com>]
7
# [SNIPPET_LICENSE: GPL]
8
9
import gwibber.lib
10
11
# first create the message - remember to keep it under 140 chars
12
message = "Sending a message from a python-snippets example! - see https://wiki.ubuntu.com/PythonSnippets for details!"
13
14
# create a connection to the running Gwibber service
15
gw = gwibber.lib.GwibberPublic()
16
17
# send the message
18
gw.SendMessage(message)
19
20
# now check your microblogging service(s) to see the message there! :-)