Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit71f77cc

Browse files
astagijoshthecoder
authored andcommitted
Add goo.gl service
1 parent013d7a4 commit71f77cc

File tree

3 files changed

+467
-433
lines changed

3 files changed

+467
-433
lines changed

‎common.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ def _test(self):
7272
try:
7373
ifself.expand(turl)=='http://test.com':
7474
returnTrue
75+
elifself.expand(turl)=='http://test.com/':
76+
returnTrue
7577
else:
7678
returnFalse
7779
exceptShortyError,e:

‎services/google.py‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
## Shorty
2+
## Copyright 2011 Andrea Stagi
3+
## See LICENSE
4+
5+
## @url goo.gl
6+
classGoogle(Service):
7+
8+
defshrink(self,bigurl):
9+
resp=request('http://goo.gl/api/url', {'url':bigurl},post_data='toolbar')
10+
data=resp.read()
11+
jdata=json.loads(data)
12+
if'short_url'notinjdata:
13+
raiseShortyError(data)
14+
else:
15+
returnjdata['short_url']
16+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp