This site is best viewed in Mozilla Firefox or Google Chrome
Fri, 18th May 2012 03:04:40
Never fear, this site is here  

Pages: 1

#Ignoring certain content-types with urllib (Python Snippet)

This is a little piece of code I wrote to intercept and disregard a http or https request from urllib.urlopen if the Content-Type header on the response is not within a list of accepted content types.

I'm sure somebody might find a use for this.

This snippet creates a customer URLopener and then overrides the open_http and open_https methods, checks for MIME type and halts the request if the response is of a MIME type you do not accept.

...

Read more

There are no comments on this post. Make a comment.

Pages: 1

Powered by Debian, Jack Daniels, Guinness, and excessive quantities of caffeine and sugar.