March 6, 2010
なんとなくツイッターStreaming APIを試してみた - xmallocのプログラミングノート

なんとなくツイッターStreaming APIを試してみたAdd Star

特に何か作ってみたいという訳でも無いんだけど、なんとなくツイッターのStreaming APIを試してみたくなったので、簡単なサンプルをPythonで作ってみました。

まずStreaming APIはこちら。

Introduction

The Twitter Streaming API allows near-realtime access to various subsets of Twitter public statuses. Developers are encouraged to read this document thoroughly.

http://apiwiki.twitter.com/Streaming-API-Documentation

パブリックタイムラインにほぼリアルタイムでアクセスできるとのことです。

Posted via web from 原宿工業大学 | Comment »

March 1, 2010
アマゾンのジェフ・ベソスも認める ツイッターの達人集団! 米ザッポスの“幸福”追求経営 | ツイッター+αのつぶやき企業戦略 | ダイヤモンド・オンライン

10のコアバリューさえ守れば
社員は自由にツイートできる

 こうして自由にやらせていることには背景がある。CEOのトニー・シェーは、ザッポスの経営で徹底的にカルチャーにフォーカスし、これを最大の資産と呼んでいる。そのカルチャーは、次の10のコア・バリュー(価値観)が基本となっている

 1)サービスを通してWOW(と言いたくなる体験)を届ける
 2)変化を受け入れ、変化をドライブする
 3)楽しさと少し変わったものを創造する
 4)冒険好きで、創造的で、オープン・マインドであれ
 5)成長と学習を探究する
 6)コミュニケーションによりオープンで正直な関係を築く
 7)ポジティブなチームとファミリーの精神を築く
 8)より少ない資源でより多くの成果を
 9)情熱と強い意志を持て
10)謙虚であれ

Posted via web from hdknr’s posterous | Comment »

February 19, 2010
クロスドメインなJavaScriptを使ったTwitterクライアント「twicli」開発中 - Okiraku Programming

Twitterクライアント機能をもつWebサービスは専用サーバを介してTwitterアクセスするものが多いのですが、これは次のような理由によります*1

TwitterAPIJSON形式で結果を取得できるAPIを提供しています。JSONJavaScriptから引数呼び出しするには都合が良いのですが、実際に他のWebサービスからAjaxAPIを呼び出そうとすると、ドメインが異なるサイトへのリクエストは投げられないというAjaxセキュリティ制約に引っかかってしまい、うまくいきません。(これに対応したJS側の動向は JavaScript 最新動向 - Shibuya.JS in Kyoto 資料が詳しい。 )


そのため対策として、

1. プロキシの役割を果たすCGIWebサービスと同じドメインに設置し、それを経由してAPIアクセスする(例:iTwitsとか)

2. JSONPSCRIPTタグ挿入を使う

3. ユーザ側にBookmarkletGreaseMonkeyを入れてもらう(例:id:monjudohのTwittalienとか)

という3択があります。参考:http://d.hatena.ne.jp/shinichitomita/20080811/1218459773

Posted via web from 原宿工業大学 | Comment »

February 16, 2010
s-take Blog.: Twitterによる簡易版OAuth: “xAuth”

OAuthにくらべてアプリケーション側もユーザ側も作業を簡略化できるxAuthですが、当然デメリットがあります。OAuthの利点の一つ、ユーザがアプリケーションにパスワードを預けなくても良いという点が完全に失われます。xAuthでは一度Access Tokenを取得してしまえばそれ以降パスワードは使用しませんが、アプリケーションがパスワードをちゃんと破棄したかどうかはユーザにはわかりません。もしかしたらこっそりパスワードを保存していて、裏でこそこそと悪さをしてしまうかもしれないのです。つまり、Basic認証によるAPI利用の欠点(のひとつ)をxAuth認証も抱えているわけです。(まあ、認証したらすぐにパスワードを変えちゃうってのもアリですが、Twitterのパスワード変更は色々と面倒なので…)

Posted via web from hdknr’s posterous | Comment »

February 9, 2010
python-oauth2 : インストールと確認

とりあえずGithubでフォークした。

pipでインストール

(twitq)hdknr@deblen:~/.ve/twitq/src$ pip install -e git+ssh://git@github.com/hdknr/python-oauth2.git#egg=python-oauth2
Obtaining python-oauth2 from git+ssh://git@github.com/hdknr/python-oauth2.git#egg=python-oauth2
  Cloning ssh://git@github.com/hdknr/python-oauth2.git to ./python-oauth2
remote: Counting objects: 427, done.
remote: Compressing objects: 100% (157/157), done.
remote: Total 427 (delta 199), reused 427 (delta 199)
  Running setup.py egg_info for package python-oauth2
Installing collected packages: python-oauth2
  Running setup.py develop for python-oauth2
    Creating /home/hdknr/.ve/twitq/lib/python2.5/site-packages/oauth2.egg-link (link to .)
    Adding oauth2 1.0.5 to easy-install.pth file

       Installed /home/hdknr/.ve/twitq/src/python-oauth2
Successfully installed python-oauth2

確認

(twitq)hdknr@deblen:~/.ve/twitq/src$ tree python-oauth2/
python-oauth2/
|-- LICENSE.txt
|-- README.md
|-- debian
|   |-- changelog
|   |-- compat
|   |-- control
|   |-- copyright
|   |-- pycompat
|   |-- pyversions
|   `-- rules
|-- example
|   |-- client.py
|   `-- server.py
|-- oauth2
|   `-- __init__.py
|-- oauth2.egg-info
|   |-- PKG-INFO
|   |-- SOURCES.txt
|   |-- dependency_links.txt
|   |-- top_level.txt
|   `-- zip-safe
|-- setup.cfg
|-- setup.py
`-- tests
    `-- test_oauth.py
 5 directories, 20 files

httplib2が必要だった。

(twitq)hdknr@deblen:~/.ve/twitq/src$ python
Python 2.5.2 (r252:60911, Jan 24 2010, 14:53:14)
[GCC 4.3.2] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
»> import oauth2 as oauth
Traceback (most recent call last):
  File “<stdin>”, line 1, in <module>
  File “/home/hdknr/.ve/twitq/src/python-oauth2/oauth2/__init__.py”, line 31, in <module>
    import httplib2
ImportError: No module named httplib2

(twitq)hdknr@deblen:~/.ve/twitq/src$ yolk -S name=httplib2
httplib2 (0.6.0):
        A comprehensive HTTP client library. (twitq)hdknr@deblen:~/.ve/twitq/src$ pip install httplib2
Downloading/unpacking httplib2
  Downloading httplib2-0.6.0.tar.gz (53Kb): 53Kb downloaded
  Running setup.py egg_info for package httplib2
Installing collected packages: httplib2
  Running setup.py install for httplib2
Successfully installed httplib2

動作確認

キー、シークレットは潰しています。
(twitq)hdknr@deblen:~/.ve/twitq/src$ python
Python 2.5.2 (r252:60911, Jan 24 2010, 14:53:14)
[GCC 4.3.2] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
»> import oauth2 as oauth
»> c=oauth.Consumer(‘fdafdsafdsafsdafdsaf’,’fdsafdsafdasfdsafdsafsdafa’)
»> url=“http://twitter.com/oauth/request_token”;
»> client = oauth.Client(c)
»> res,content = client.request(url,’GET’)
»> type(res)
<class ‘httplib2.Response’>
»> type(content)
<type ‘str’>
»> print content
oauth_token=reoqrdsafdsalfdsafd432fhdsahfdhsafdsafdsafdas&oauth_token_secret=fdr42qr3ofdoashfdsafedeq
»> print res
{‘status’: ‘200’, ‘content-length’: ‘116’, ‘content-location’: ‘http://twitter.com/oauth/request_token?oauth_nonce=91616366&oauth_timestamp=1265663914&oauth_consumer_key=fdsafdasfdafdafdsafda&oauth_signature_method=HMAC-SHA1&oauth_version=1.0&oauth_signature=fdsafdafdafdsafdsafdsafdaf%3D’;, ‘x-transaction’: ‘542354954-432143-4324’, ‘set-cookie’: ‘_twitter_sess=fdasfdsafdsa%dsafdsafdf%fdsafa—fdsafdsa; domain=.twitter.com; path=/’, ‘expires’: ‘Tue, 31 Mar 1981 05:00:00 GMT’, ‘vary’: ‘Accept-Encoding’, ‘x-runtime’: ‘0.01270’, ‘server’: ‘hi’, ‘x-revision’: ‘DEV’, ‘last-modified’: ‘Mon, 08 Feb 2010 21:18:34 GMT’, ‘connection’: ‘close’, ‘etag’: ‘“2a33d94df68b07474217bf29f093c169”-gzip’, ‘pragma’: ‘no-cache’, ‘cache-control’: ‘no-cache, no-store, must-revalidate, pre-check=0, post-check=0’, ‘date’: ‘Mon, 08 Feb 2010 21:18:34 GMT’, ‘content-type’: ‘text/html; charset=utf-8’, ‘-content-encoding’: ‘gzip’}

Posted via email from 原宿工業大学 | Comment »

January 30, 2010
Step by Step Guide to use Sign in with Twitter with Django « Agile Web Development

If you will have a look at OAuth examples on twitter apiwiki there are already examples available to use Sign in with Twitter with Django, so why this new howto and example code. Because being a perfectionist I like things to be the standard way, so for authentication django allows you to specify your own customized authentication backends. I thought why should not that be utilized to authenticate the Django User object with twitter.

Posted via web from 原宿工業大学 | Comment »

Twitter / アプリケーション : OAuthのコンシューマーキーの登録

Welcome to the Developer Beta of the Twitter Application Platform! We’re just getting started, but we thought we’d start releasing components that will help you, the developers, connect your users with the world, right now.

For starters, we’re allowing you to both register your application here, as well as providing an improved Authentication System, OAuth. To read more about how this help both you and your users, please visit http://oauth.net.

Enjoy! And please report any bugs or general feedback to api@twitter.com.

Posted via web from 原宿工業大学 | Comment »

January 25, 2010
Spaz: A Twitter, Identi.ca and Laconica client for Palm® Pre™, Windows, Mac OS X and Linux

Webサイトがカッコいい。

Posted via web from hdknr’s posterous | Comment »

January 23, 2010
python:libxslt : Twitter atom feed からSQL文を作成

Feed URL の取得は XSLTテンプレートで、


なのでプロセッサースクリプトに def get_author_id(ctx,str):
m =re.search(‘([^/]+).atom$’,str)
return m.group(1)

を定義して、 libxslt.registerExtModuleFunction(“get_author_id”,ATOM, get_author_id)

と登録して、XSTLテンプレートを ”,

に変更して実行すると、 insert into tweets_tweet values (”,
‘ひできならでは’,
‘8015912’,
‘http://d.hatena.ne.jp/hdknr/’,
‘2010/01/23 13:12:33’,
‘2010/01/23 13:12:33’,
‘http://twitter.com/hdknr/statuses/8098728166’,
‘hdknr: @doramimy 答えはリンク先の写真をクリック!’,
‘hdknr: @doramimy 答えはリンク先の写真をクリック!’
)
ON DUPLICATE KEY UPDATE link=VALUES(link);

な感じでSQL文に変更される。

Posted via email from 原宿工業大学 | Comment »

January 19, 2010
日垣隆氏が放つ怒りのハンマーが、週刊ダイヤモンド編集部に直撃: 切込隊長BLOG(ブログ) Lead‐off man’s Blog

 このように、群がるDISコメを当たるを幸い真っ二つに叩き斬って、目指すはダイヤモンド編集部から出る納得のいく謝罪のみという潔さです。凄い。凄すぎるのであります。結果的に、週刊ダイヤモンドも炎上マーケティングを敢行したも同然で、この際、日垣氏と何らかコラボレーションしてみるというのはどうなんでしょうか。

雑誌社がネット時代に生き残るための新しい炎上マーケティング仮説。

Posted via web from hdknr’s posterous | Comment »