Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions goose/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ def __init__(self):
# http timeout
self.http_timeout = HTTP_DEFAULT_TIMEOUT

# proxy settings
self.http_proxy = None
self.https_proxy = None

def get_parser(self):
return AVAILABLE_PARSERS[self.parser_class]

Expand Down
10 changes: 10 additions & 0 deletions goose/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ def __init__(self, config):
# set header
self.headers = {'User-agent': self.config.browser_user_agent}

proxies = {}
if self.config.http_proxy is not None:
proxies["http"] = self.config.http_proxy;
if self.config.https_proxy is not None:
proxies["https"] = self.config.https_proxy;
if len(proxies) > 0:
proxy = urllib2.ProxyHandler(proxies)
opener = urllib2.build_opener(proxy)
urllib2.install_opener(opener)

def get_url(self):
# if we have a result
# get the final_url
Expand Down