python-ox/README

38 lines
776 B
Text
Raw Normal View History

2010-07-07 23:25:57 +00:00
python-ox some tools to build tools
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/)
python-beautifulsoup (http://www.crummy.com/software/BeautifulSoup/)
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