Fork me on GitHub

2007/08/30

Recent entries from same category

  1. PLAYLOGがサービス終了 Hatena
  2. Dropboxの容量が増えた。 Hatena
  3. Facebookの今後を勝手に予測してみる。 Hatena
  4. FirefoxでGoogle Buzzを高速に扱う方法! Hatena
  5. twitterfeedからFeedTweetに乗り換えた。 Hatena

このエントリーをはてなブックマークに追加
ブログ引退表明サービスRetiredAPIをpythonから使うサンプルです。
URLを指定すると引退しているかどうかがTrue/Falseで戻ります。
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import httplib

def isRetired(url):
    conn = httplib.HTTPConnection("retired.at")
    conn.request('GET', '/api/badge/%s' % url)
    response = conn.getresponse()
    return response.getheader("Location") == "http://retired.at/image/retired.gif"
ちなみに、hkn?さんの日記で試すと、Trueが戻ります。
>> print isRetired("http://d.hatena.ne.jp/hkn/20070829/1188318885")
True
Posted at 10:29 in web | Edit
Tagged as: API, python
Bookmarks: add to hatena add to hatena | add to delicious.com | add to livedoor.clip add to livedoor.clip

blog comments powered by Disqus