python-ox/README
2010-11-23 10:24:38 +01:00

38 lines
824 B
Text

python-ox - the web in a dict
Depends:
python2.5
python-chardet (http://chardet.feedparser.org/)
python-feedparser (http://www.feedparser.org/)
python-lxml (http://codespeak.net/lxml/) [optional]
django (otherwise dates < 1900 are not supported) [optional]
Usage:
import ox
data = ox.cache.readUrl('http:/...')
text = ox.stripTags(data)
ox.normalizeNewlines(text)
ox.formatBytes(len(data))
ox.formatBytes(1234567890)
'1.15 GB'
import ox.web.imdb
imdbId = ox.web.imdb.guess('The Matrix')
info = ox.web.imdb.Imdb(imdbId)
info['year']
1999
Install:
python setup.py install
Cookies:
some ox.web modules require user accont information or cookies to work,
those are saved in ~/.ox/auth.json, most basic form looks like this:
{
"key": "value"
}
Tests:
nosetests --with-doctest ox