开发者

Using CURL with oauth for desktop-couch

To access desktopcouch the documentation suggest to use oauth. Using the samples in the O'Reilly book "CouchDB - the definite guide" I want to use CURL (or another command line tool if appropriate) to w开发者_高级运维ork with desktopcouch. I guess I would need a script to query the key store to retrieve the oauth token and add it to the CURL string. Ideally I would like to create a couchurl script file that I can use instead of the CURL command for the samples in the book. How would that script look like?


You can use twurl: http://thechangelog.com/post/536535280/twurl-oauth-enabled-curl-for-the-twitter-api

Twurl - OAuth-enabled curl for the Twitter API Wynn Netherland

OAuth is cool but developing with OAuth can be a pain. Inspired by curl and Hurl.it (featured on Episode 0.1.5 with Leah Culver), the Twitter team has realeased a couple of tools to make developing with the Twitter OAuth API much easier.

Twurl is a Ruby gem from Marcel Molina that lets you make requests to the Twitter OAuth API from the console. To begin install the gem:

$ sudo gem install twurl

Then from the command line (not the Ruby console) you can authorize twurl using your API keys:

$ twurl authorize --consumer-key the_key --consumer-secret the_secret

Now you can make requests to API methods:

$ twurl /1/statuses/home_timeline.xml

The Twitter team also has a nifty GUI version up on the new Twitter Developers Site that even pre-populates your Twitter apps in a drop-down.


If python is an option, it's pretty easy to implement oAuth clients using python-oauth2.

I tried to get OAuth working using curl but there was a lot of information passing to get it through all four steps: request_token, authorize, request_access, access. I was heading towards a fairly complicated script to do so. Certainly it was going to be more work than just using python-oauth2.


There are two Python command-line tools for interacting with OAuth services a la curl:

  • curl-oauth for OAuth 1.0
  • curlish for OAuth 2.0
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜