Merge lp:~diesch/python-snippets/pygtk-snippets into lp:~jonobacon/python-snippets/trunk

Proposed by Florian Diesch
Status: Needs review
Proposed branch: lp:~diesch/python-snippets/pygtk-snippets
Merge into: lp:~jonobacon/python-snippets/trunk
Diff against target: 83 lines (+79/-0)
1 file modified
twitter/identica.py (+79/-0)
To merge this branch: bzr merge lp:~diesch/python-snippets/pygtk-snippets
Reviewer Review Type Date Requested Status
Akkana Peck (community) Approve
Jono Bacon Pending
Review via email: mp+24066@code.launchpad.net

Description of the change

added twitter/identica.py: get timeline and update status from identi.ca

To post a comment you must log in.
Revision history for this message
Akkana Peck (akkzilla) wrote :

Hi -- I'm a new maintainer python-snippets. Your snippet works great for identi.ca, but if I uncomment the twitter lines there's a syntax error for SECURE= . What should SECURE be set to? Or should I just remove the commented-out twitter lines and commit it just for the identi.ca part?

review: Needs Information
Revision history for this message
Florian Diesch (diesch) wrote :

It's been a while since that. But I guess it should be

 # SECURE=False

Quite likely that doesn't work anymore as I don't think Twitter supports that kind of authentication anymore so you'll may want to remove all the Twitter related stuff.

Revision history for this message
Akkana Peck (akkzilla) wrote :

Okay, I'll remove the twitter stuff. They broke a lot of python_twitter code too when they disabled basic authentication. The rest looks fine. I'm having some trouble figuring out launchpad and merges -- all the merge requests for python-snippets are against Jono's branch, and there doesn't seem to be any way to close them even when I approve the merges, but I'll check this in as soon as I get that figured out. Thanks for the contribution!

Revision history for this message
Akkana Peck (akkzilla) wrote :

... but at least I can mark it Approved for now.

review: Approve

Unmerged revisions

100. By Florian Diesch

added twitter/identica.py

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'twitter/identica.py'
--- twitter/identica.py 1970-01-01 00:00:00 +0000
+++ twitter/identica.py 2010-04-24 22:34:15 +0000
@@ -0,0 +1,79 @@
1#!/usr/bin/env python
2#-*- coding: utf-8-*-
3
4# [SNIPPET_NAME: Access identi.ca]
5# [SNIPPET_CATEGORIES: twitter]
6# [SNIPPET_DESCRIPTION: get timeline and update status from identi.ca]
7# [SNIPPET_AUTHOR: Florian Diesch <diesch@spamfence.net>]
8# [SNIPPET_DOCS: http://joshthecoder.github.com/tweepy/docs/index.html]
9# [SNIPPET_LICENSE: MIT]
10
11# Copyright 2010 Florian Diesch <diesch@spamfence.net>
12# All rights reserved.
13#
14# Permission is hereby granted, free of charge, to any person obtaining a copy
15# of this software and associated documentation files (the "Software"), to deal
16# in the Software without restriction, including without limitation the rights
17# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18# copies of the Software, and to permit persons to whom the Software is
19# furnished to do so, subject to the following conditions:
20#
21# The above copyright notice and this permission notice shall be included in
22# all copies or substantial portions of the Software.
23#
24# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
30# THE SOFTWARE.
31#
32
33import tweepy
34# See http://joshthecoder.github.com/tweepy/
35
36
37## change this to your account
38USER='some_user'
39PASSWORD='12345'
40
41## for identi.ca
42HOST='identi.ca'
43API_ROOT='/api'
44SECURE=True
45
46## for twitter.com
47# HOST='api.twitter.com'
48# API_ROOT='/'
49# SECURE=
50
51
52auth = tweepy.BasicAuthHandler(USER, PASSWORD)
53api = tweepy.API(auth,
54 host=HOST,
55 api_root=API_ROOT,
56 secure=SECURE
57 )
58
59
60## get first 10 items of your home timeline:
61
62try:
63 for status in tweepy.Cursor(api.home_timeline).items(10):
64 print '-'*20
65 print status.user.screen_name
66 print status.author.name
67 print status.text
68except tweepy.error.TweepError, e:
69 print 'Error getting timeline:', e
70
71## update your status:
72try:
73 api.update_status(status='Trying an example from Acire http://www.launchpad.net/acire')
74except tweepy.error.TweepError, e:
75 print "Can't update status:", e
76else:
77 print "Updated status."
78
79

Subscribers

People subscribed via source and target branches