The website technology supporting Philadelphia Reflections is PHP, MySQL and DHTML. The web hosting service is Internet Planners. The development of this website has provided an opportunity to learn new technology, to try out different techniques for getting noticed by the search engines and the trials and tribulations of dealing with malicious hackers and spammers who range from the annoying to the abusive. This collection of articles documents some of our experiences and we hope that people surfing the web looking for solutions to problems we've encountered will benefit.
George IV and Computers(1)
I got him into computers around 1960. He soon far surpassed me.
In case you're wondering "How the heck does Python handle headers and data under 3.2.2?", here's an example that works using IDLE and Python 3.2.2 installed on a 64-bit Windows 7 machine.
import re import urllib.request url = "http://www.philadelphia-reflections.com" uf = urllib.request.urlopen(url) # header information print('--- headers ---') info = uf.info() # headers #headers = info._headers # a list of all the headers print('charsets:',info.get_charsets()) print('content_charset:',info.get_content_charset()) print('content_type:',info.get_content_type()) print('content_maintype:',info.get_content_maintype()) print('content_subtype:',info.get_content_subtype()) print('default_type:',info.get_default_type()) print('filename:',info.get_filename()) print('params:',info.get_params()) print('payload:',info.get_payload()) print() print('--- data ---') data = uf.read().decode(info.get_content_charset()) # content print(data[:500]) print() print('--- image ---') imageurl = url + "/images/001.JPG" image = urllib.request.urlretrieve(imageurl, 'python_001.jpg') print(image)
Originally published: Monday, January 16, 2012; most-recently modified: Monday, June 03, 2019