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 on page encoding, parsers and multiple approaches to some tasks.
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.
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.
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.
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.
Support This Site
Did you find something here useful? Please consider putting a tip in my tip jar. Many thanks!
Donate via PayPal:
Making your Amazon.com purchases through my affiliate link helps to support this site at no added cost to you.
Looking for affordable, managed web hosting? Try my hosting service.
Looking for affordable, unmanaged hosting? Try GreenGeeks web hosting for only $3.95 per month.