python-ox/README

39 lines
824 B
Text
Raw Normal View History

2010-09-03 21:19:19 +00:00
python-ox - the web in a dict
2008-04-27 16:54:37 +00:00
Depends:
python2.5
python-chardet (http://chardet.feedparser.org/)
2010-07-07 23:25:57 +00:00
python-feedparser (http://www.feedparser.org/)
2010-11-23 09:24:38 +00:00
python-lxml (http://codespeak.net/lxml/) [optional]
django (otherwise dates < 1900 are not supported) [optional]
2008-04-27 16:54:37 +00:00
Usage:
2010-07-07 23:25:57 +00:00
import ox
2008-04-27 16:54:37 +00:00
2010-07-07 23:25:57 +00:00
data = ox.cache.readUrl('http:/...')
text = ox.stripTags(data)
ox.normalizeNewlines(text)
ox.formatBytes(len(data))
2008-04-27 16:54:37 +00:00
2010-07-07 23:25:57 +00:00
ox.formatBytes(1234567890)
2008-04-27 16:54:37 +00:00
'1.15 GB'
2010-07-07 23:25:57 +00:00
import ox.web.imdb
imdbId = ox.web.imdb.guess('The Matrix')
info = ox.web.imdb.Imdb(imdbId)
info['year']
1999
2009-08-21 15:18:03 +00:00
Install:
python setup.py install
2010-07-07 23:25:57 +00:00
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:
2010-07-07 23:25:57 +00:00
nosetests --with-doctest ox