Skip to content Skip to sidebar Skip to footer

Python Urllib2 With Tor Proxy Throws `HTTP Error 403`

I am trying to parse a web page using this solution like the following: from bs4 import BeautifulSoup as bs import re import time import random ---------------------- import socks

Solution 1:

I'd highly recommend firing up Wireshark and making sure that your requests are being proxied as you think they are.

BeautifulSoup may be the culprit here as it would logically be importing the socket module first, so try making your import the following:

import socks    # Import this first no matter what
import socket    
import re
import time
import random
from bs4 import BeautifulSoup as bs 

Post a Comment for "Python Urllib2 With Tor Proxy Throws `HTTP Error 403`"