Merge lp:~sandaru1/gwibber/bitly into lp:gwibber/1.2

Proposed by Sandaruwan
Status: Rejected
Rejected by: Ken VanDine
Proposed branch: lp:~sandaru1/gwibber/bitly
Merge into: lp:gwibber/1.2
Diff against target: None lines
To merge this branch: bzr merge lp:~sandaru1/gwibber/bitly
Reviewer Review Type Date Requested Status
Ken VanDine Disapprove
Review via email: mp+10607@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Sandaruwan (sandaru1) wrote :

Added bitly service for url shortening

Revision history for this message
Ken VanDine (ken-vandine) wrote :

Sorry this took so long to get reviewed, this no longer applies to trunk.

Thanks for your submission.

review: Disapprove

Unmerged revisions

359. By Sandaruwan Gunathilake <sandaru1@sandaru1-laptop>

bitly url shorter

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'gwibber/urlshorter/__init__.py'
2--- gwibber/urlshorter/__init__.py 2009-06-20 12:10:45 +0000
3+++ gwibber/urlshorter/__init__.py 2009-08-24 17:43:35 +0000
4@@ -1,9 +1,10 @@
5
6-import cligs, isgd, tinyurlcom, trim, ur1ca, punyslpt, upunyslpt, unu
7+import cligs, isgd, tinyurlcom, trim, ur1ca, punyslpt, upunyslpt, unu, bitly
8 #import snipurlcom, zima
9
10 PROTOCOLS = {
11 "cli.gs": cligs,
12+ "bit.ly": bitly,
13 "is.gd": isgd,
14 #"snipurl.com": snipurlcom,
15 "tinyurl.com": tinyurlcom,
16
17=== added file 'gwibber/urlshorter/bitly.py'
18--- gwibber/urlshorter/bitly.py 1970-01-01 00:00:00 +0000
19+++ gwibber/urlshorter/bitly.py 2009-08-24 17:43:35 +0000
20@@ -0,0 +1,25 @@
21+
22+"""
23+
24+bit.ly interface for Gwibber
25+sandaru1 (Sandaruwan Gunathilake) - 08/24/2009
26+
27+"""
28+
29+import urllib2
30+import json
31+
32+PROTOCOL_INFO = {
33+
34+ "name": "bit.ly",
35+ "version": 0.1,
36+ "fqdn" : "http://bit.ly",
37+
38+}
39+
40+class URLShorter:
41+
42+ def short(self, text):
43+ json_str = urllib2.urlopen("http://api.bit.ly/shorten?version=2.0.1&longUrl=%s&login=bitlyapidemo&apiKey=R_0da49e0a9118ff35f52f629d2d71bf07" % urllib2.quote(text)).read()
44+ return json.loads(json_str)['results'][text]['shortUrl']
45+

Subscribers

People subscribed via source and target branches