My favorites | Sign in
Project Logo
                
Code license: MIT License
Labels: python, http, client, cli, rest, restful, api
Show all Featured wiki pages:
HTTPConnection
Feeds:
People details
Project owners:
  miles.chris

restez is a command-line HTTP client written in Python.

restez also provides a high-level simple to use HTTP client API. See HTTPConnection.

Examples

Fetch a JSON representation of a resource:

$ restez GET http://localhost/app/resource/3 --accept application/json
Response Headers
 status: 200
 content-length: 61
 content-location: http://localhost/app/resource/3
 server: Apache/2.0.63 (Unix) DAV/2 mod_wsgi/2.3 Python/2.5.2
 pragma: no-cache
 cache-control: no-cache
 date: Thu, 08 Jan 2009 12:14:55 GMT
 content-type: application/json; charset=utf-8

Response body (61 bytes, application/json) [p]pager, [d]isplay, [w]rite to file, [s]kip ? d
{"timestamp": null, "product": "0", "user": "3", "result": 0}

Response status: 200 (OK)

Post a JSON request to a web app:

$ restez POST http://localhost/api/index data.json 
Response Headers
 status: 200
 content-length: 59
 server: CherryPy/2.3.0
 date: Thu, 08 Jan 2009 11:56:28 GMT
 content-type: application/json

Response body (59 bytes, application/json) [p]pager, [d]isplay, [w]rite to file, [s]kip ? d
{"status": "success", "version": "1.2.2"}

Response status: 200 (OK)

Make a POST request, specifying parameters and setting a cookie:

$ restez POST http://localhost:9090/testapp/stats -p "month=June 2009" -p "format=csv" -H "Cookie: visit=fca17f0b0e8b8deac506c06ef801ae7f2fc292c4"
Sending POST request to http://localhost:9090/testapp/stats

Request headers include (HTTP client library may add more):
 Content-Type: application/x-www-form-urlencoded
 Cookie: visit= fca17f0b0e8b8deac506c06ef801ae7f2fc292c4
 User-Agent: restez/0.2.2

Response Headers
  status: 200
  content-length: 363
  content-disposition: attachment; filename=stats.csv
  set-cookie: visit= fca17f0b0e8b8deac506c06ef801ae7f2fc292c4; Path=/;
  server: CherryPy/2.3.0
  connection: close
  date: Fri, 05 Jun 2009 02:51:23 GMT
  content-type: text/csv

Response body (363 bytes, text/csv) [p]pager, [d]isplay, [w]rite to file, [s]kip ? p

Response status: 200 (OK)








Hosted by Google Code