RestXL

Python REST framework
Download

RestXL Ranking & Summary

Advertisement

  • Rating:
  • License:
  • MIT/X Consortium Lic...
  • Price:
  • FREE
  • Publisher Name:
  • Brian Jinwright
  • Publisher web site:
  • http://github.com/bjinwright/

RestXL Tags


RestXL Description

Python REST framework The RestXL project exists to make it easier to create REST clients that are also very easy to understand.The cores of this project are requests, url variables, headers, and RestXLers.Simple ExampleExample Requesthttp://api.example.com/API/search?search_term=ipootsHEADERS:: GET /API/search?search_term=ipoots HTTP/1.1 Host: api.example.com Auth-User: brian Auth-Key: abcdefg123456abcdefg123456RequestsThe request to the REST api. This is symbolized below by the Request classURL VariablesQuery string variables. (search term is the specified url variables in the example above)HeadersRequest headers. (auth_user and auth_key are the specified headers in the example above)These are specified in the following way:from restxl import request,clientclass KeywordSearch(request.Request): #This is the URL Variable. CharVarible is a subclass of the URLVariable class. search_term = request.CharVariable(required=True) #These are the Headers. CharHeader is a subclass of the Header class. auth_user = request.CharHeader(required=True,verbose_name='Auth-User') auth_key = request.CharHeader(required=True,verbose_name='Auth-Key') class Meta: method = 'GET' #GET is the default response_type = 'xml' #xml is the default request_url = http://www.example.com request_path = '/API/search'class ExampleAPI(RestXLer): keyword_search = KeywordSearch#To create an instance and use the ExampleAPI do the followingexapi = ExampleAPI()#Call the keyword_search methodkey_search = exapi( 'keyword_search', search_term='iPoots', auth_user='brian', auth_key='abcdefg123456abcdefg123456' )RestXLerThis is the master client class. Create an attribute for each Request class associated with the API. (ExampleAPI is the specified RestXLer in the example above)Installing restxlInstall into your python path using pip or easy_install:pip install restxleasy_install restxl Requirements: · Python · simplexmlapi · Beautiful Soup · simplejson · httplib2


RestXL Related Software