scandalous
scandalous

Reputation: 912

Matching contents of an html file with keyword python

I am making a download manager. And I want to make the download manager check the md5 hash of an url after downloading the file. The hash is found on the page. It needs to compute the md5 of the file ( this is done), search for a match on the html page and then compare the WHOLE contents of the html page for a match.

my question is how do i make python return the whole contents of the html and find a match for my "md5 string"?

Upvotes: 0

Views: 190

Answers (2)

jurgenreza
jurgenreza

Reputation: 6086

import urllib and use urllib.urlopen for getting the contents of an html. import re to search for the hash code using regex. You could also use find method on the string instead of regex.

If you encounter problems, then you can ask more specific questions. Your question is too general.

Upvotes: 1

GabiMe
GabiMe

Reputation: 18473

Requests lib is what you want to use. Will save you lots of trouble

Upvotes: 3

Related Questions