Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

python binding for parsley

branch: master

Create LICENSE

latest commit 3d4235b44c
Kyle Maxwell authored January 19, 2013
Octocat-spinner-32 test added unicode tests December 24, 2009
Octocat-spinner-32 .gitignore python as root March 03, 2009
Octocat-spinner-32 LICENSE Create LICENSE January 19, 2013
Octocat-spinner-32 README doc patch April 01, 2009
Octocat-spinner-32 pyparsleymodule.c added unicode tests December 24, 2009
Octocat-spinner-32 setup.py python as root March 03, 2009
README
ABOUT

Python 2.x bindings for Parsley.  Tested with Python 2.5 and 2.6.

INSTALLATION

= Get Parsley and Dependancies = 

Download Parsley from http://github.com/fizx/parsley/tree/master following the installation directions located at http://github.com/fizx/parsley/blob/master/INSTALL

For Python 2.5, the simplejson library is required.  For Python 2.6 and later, the stdlib json library is used.	

= Install pyparsely =

sudo python setup.py install

= Example Code =

  from pyparsley import PyParsley

  # Valid options (all are named arguments):
  #
  # Requires one of:
  # 'file' -- the input file path or url
  # 'string' -- the input string
  #
  # And optionally (default is the first listed value):
  # 'input' => ['html', 'xml']
  # 'output' => ['python', 'json', 'xml']
  # 'prune' => [true, false]
  # 'collate' => [true, false]
  # 'base' => 'http://some/base/href'
  # 'allow_net' => [true, false]
  # 'allow_local' => [true, false]

  parselet = PyParsley({ 
                         "title": "title", 
                         "links(a)": [
                           { 
                             "name": ".", 
                             "href": "@href" 
                           }
                         ]
                       })
  json_string = parselet.parse(file = some_file, output = "json")
  # Using Parsley's builtin URI fetching.
  json_string = parselet.parse(file = "http://www.example.com/", output = "json")
Something went wrong with that request. Please try again.