Some experiments in website scraping using Python 2.7 with BeautifulSoup 3.2. The first function here shows various manipulations of an HTML page, including saving a scrubbed file to disk. The second function shows a simple crawler that attempts to traverse a domain and build a sitemap from hyperlinks encountered in the pages. Includes some commentary […]
Tag: Python
Python: Statistics Calculators
Some statistics calculators written for Python 2.x (the str.format() method requires Python >= 2.6). Of course you could just use the numpy or statistics libraries, but where’s the fun in that? All solutions verified where possible by Wolfram Alpha or else by EasyCalculation.com.
Python: XML-RPC Requests
Tinkering with Python xmlrpclib, in this case for updating a WordPress blog from the command line. Using Python 2.7.6 here. xmlrpclib is included with Python 2.7, but if you need it, install with Pip.
Python: MIME/SMTP
Send a MIME-encoded email in HTML and plain text using Python’s smtplib (Python 2.x). Just call ‘mailer’ with a return address, list of recipients, message subject and body.
Python LDAP Lookups
An example of a Python LDAP lookup, Python 2.x. This one uses the on-campus LDAP service at UC Davis, so just change the LDAPServer and searchBase for another LDAP server. Or you can print the results a little more nicely:
Migrate Zope/Plone from CentOS to Ubuntu
I don’t use Zope and Plone anymore, but if you’ve played with Zope/Plone you know they are highly proprietary, fragile, missing a lot of desirable functionality, and overall pretty painful to manage. About the only thing I really ever liked about them was the relative ease of integrating Python libraries and code. Regardless, I sometimes […]