Skip to content

Instantly share code, notes, and snippets.

@nharrell04
Last active December 20, 2015 01:38
Show Gist options
  • Save nharrell04/6050052 to your computer and use it in GitHub Desktop.
Save nharrell04/6050052 to your computer and use it in GitHub Desktop.
from urllib2 import urlopen
from hashlib import md5
from collections import namedtuple
class research_guides:
def __init__(self, url, hashes, title, author, subject):
self.url= url
self.hashes = hashes
self.title = title
self.author = author
self.subject = subject
Guide = namedtuple('Guide', ['url', 'hashes', 'title', 'author', 'subject'])
def getdahash(self):
return md5(urlopen(self.url).read()).hexdigest()
def makeGuide(self):
return self.Guide(self.url, self.getdahash(), self.title, self.author, self.subject)
test1 = research_guides("http://www.law.georgetown.edu/library/research/guides/adminlaw.cfm","","Administrative Law Research Guide",
"Georgetown Law Library",
"Administrative Law")
test2 = research_guides("http://www.law.georgetown.edu/library/research/guides/aviationlaw.cfm",
"","Aviation Law Research Guide","Georgetown Law Library","Aviation Law")
print test1.makeGuide()
print test2.getdahash()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment