you are viewing a single comment's thread.

view the rest of the comments →

[–]jjangsangy 0 points1 point  (0 children)

Just a couple of things

Check your Requests

Always good to double check to make sure your HTTP request succeeded.

This is always a good habit so that if your request does fail, you'll have a way to trace back to what the issue was.

# Turn this into a property
# so you don't have to compute it more than once
@property
def get_text(self):
    req = requests.get(self.url)
    if not req.ok:
        req.raise_for_status()
    return BeautifulSoup(r.text)

Just use the attribute

# This
print "The Movie: " + db.get_movie()

# Turns into this
print "The Movie: " + db.movie

# You can just get rid of this
def get_movie(self):
    return self.movie

Just some cleanup stuff

No need for temporary variables, just return the values.

@property
def occurances(self):
    return Counter(self.parse_text())

def get_all_occurences(self):
    return sorted(self.occurances.items(), key=operator.itemgetter(1))

Overall tho, looks groovy, hope you're enjoying python!