とりあえずGithubでフォークした。
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
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’}
pipでインストール
(twitq)hdknr@deblen:~/.ve/twitq/src$ pip install -e git+ssh://git@github.com/hdknr/python-oauth2.git#egg=python-oauth2Obtaining 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$ pythonPython 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 »