python-ox/README

39 lines
824 B
Text
Raw Normal View History

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