jimbomorrison / tqurl

OAuth-enabled curl for the twiDAQ API (borrowing almost entirely from twurl)

Home Page:http://twitter.com/about/opensource

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

+-------+
| Tqurl |
+-------+

Tqurl is basically twurl - with a modified default host!

Twurl is like curl, but tailored specifically for the Twitter API.
It knows how to grant an access token to a client application for
a specified user and then sign all requests with that access token.

It also provides other development and debugging conveniences such
as defining aliases for common requests, as well as support for
multiple access tokens to easily switch between different client
applications and Twitter accounts.

+-----------------+
| Getting Started |
+-----------------+

The first thing you have to do is register an OAuth application
to get a consumer key and secret.

  http://dev.twitter.com/apps/new

When you have your consumer key and its secret you authorize
your Twitter account to make API requests with your consumer key
and secret.

  % tqurl authorize --consumer-key the_key       \
                    --consumer-secret the_secret

This will return an URL that you should open up in your browser.
Authenticate to Twitter, and then enter the returned PIN back into
the terminal.  Assuming all that works well, you will beauthorized
to make requests with the API. Tqurl will tell you as much.

If your consumer application has xAuth enabled, then you can use
a variant of the above

  % tqurl authorize -u username -p password      \
                    --consumer-key the_key       \
                    --consumer-secret the_secret

And, again assuming your username, password, key and secret is
correct, will authorize you in one step.

+-----------------+
| Making Requests |
+-----------------+

The simplest request just requires that you specify the path you
want to request.

  % tqurl /1/statuses/home_timeline.xml

Similar to curl, a GET request is performed by default.

You can implicitly perform a POST request by passing the -d option,
which specifies POST parameters.

  % tqurl -d 'status=Testing tqurl' /1/statuses/update.xml

You can explicitly specify what request method to perform with
the -X (or --request-method) option.

  % tqurl -X DELETE /1/statuses/destroy/123456.xml

+------------------+
| Creating aliases |
+------------------+

  % tqurl alias h /1/statuses/home_timeline.xml

You can then use "h" in place of the full path.

  % tqurl h

Paths that require additional options such as request parameters for example can
be used with aliases the same as with full explicit paths, just as you might
expect.

  % tqurl alias tweet /1/statuses/update.xml
  % tqurl tweet -d "status=Aliases in tqurl are convenient"

+-------------------------------+
| Changing your default profile |
+-------------------------------+

The first time you authorize a client application to make requests on behalf of your account, tqurl stores your access token information in its .tqurlrc file. Subsequent requests will use this profile as the default profile. You can use the 'accounts' subcommand to see what client applications have been authorized for what user names:

  % tqurl accounts
  noradio
    HQsAGcBm5MQT4n6j7qVJw
    hhC7Koy2zRsTZvQh1hVlSA (default)
  testiverse
    guT9RsJbNQgVe6AwoY9BA

Notice that one of those consumer keys is marked as the default. To change the default use the 'set' subcommand, passing then either just the username, if it's unambiguous, or the username and consumer key pair if it isn't unambiguous:

  % tqurl set default testiverse
  % tqurl accounts
  noradio
    HQsAGcBm5MQT4n6j7qVJw
    hhC7Koy2zRsTZvQh1hVlSA
  testiverse
    guT9RsJbNQgVe6AwoY9BA (default)

  % tqurl set default noradio HQsAGcBm5MQT4n6j7qVJw
  % tqurl accounts
  noradio
    HQsAGcBm5MQT4n6j7qVJw (default)
    hhC7Koy2zRsTZvQh1hVlSA
  testiverse
    guT9RsJbNQgVe6AwoY9BA

+--------------+
| Contributors |
+--------------+

Marcel Molina <marcel@twitter.com> / @noradio
Raffi Krikorian <raffi@twitter.com> / @raffi

About

OAuth-enabled curl for the twiDAQ API (borrowing almost entirely from twurl)

http://twitter.com/about/opensource

License:MIT License


Languages

Language:Ruby 100.0%