Skip to content

Instantly share code, notes, and snippets.

@arafatkamaal
Created May 7, 2014 14:55
Show Gist options
  • Save arafatkamaal/c6a4501c9b5ef7dd6117 to your computer and use it in GitHub Desktop.
Save arafatkamaal/c6a4501c9b5ef7dd6117 to your computer and use it in GitHub Desktop.
Scraper
#
# This program scrapes the FIFA Data from the site:
# http://thesoccerworldcups.com/index.php
#
#
import urllib2
#####################################################################
# Implementation of classes starts here #
#####################################################################
#####################################################################
# Implementation of functions starts here #
#####################################################################
def get_page( url ):
if not url:
return False
try:
request = urllib2.Request( url )
response = urllib2.urlopen( request )
data = response.read()
return data
except urllib2.HTTPError as e:
print "The url" + url + "returned with error code " + e.code + " and " + e.read()
return False
#####################################################################
# Main function #
#####################################################################
get_page( 'http://www.google.com' )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment