diff options
author | James Taylor <user234683@users.noreply.github.com> | 2020-10-25 11:15:59 -0700 |
---|---|---|
committer | James Taylor <user234683@users.noreply.github.com> | 2020-10-25 11:15:59 -0700 |
commit | 3a081a9c465828b3491d15b673074b7dbdcfc822 (patch) | |
tree | c391332acabb89395820fec894bc76606a9f45b2 /youtube/__init__.py | |
parent | bcaec7b7d3bb6086ec2f6d0726a641e67a524789 (diff) | |
download | yt-local-3a081a9c465828b3491d15b673074b7dbdcfc822.tar.lz yt-local-3a081a9c465828b3491d15b673074b7dbdcfc822.tar.xz yt-local-3a081a9c465828b3491d15b673074b7dbdcfc822.zip |
Automatically change tor circuit once if ip is blocked
Use stem library to send a new identity signal via the tor
control port.
See #20
Diffstat (limited to 'youtube/__init__.py')
-rw-r--r-- | youtube/__init__.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/youtube/__init__.py b/youtube/__init__.py index 6d79e44..a8ca227 100644 --- a/youtube/__init__.py +++ b/youtube/__init__.py @@ -68,8 +68,10 @@ def error_page(e): error_message = ('Error: Youtube blocked the request because the Tor' ' exit node is overutilized. Try getting a new exit node by' ' using the New Identity button in the Tor Browser.') + if exc_info()[1].error_message: + error_message += '\n\n' + exc_info()[1].error_message if exc_info()[1].ip: - error_message += ' Exit node IP address: ' + exc_info()[1].ip + error_message += '\n\nExit node IP address: ' + exc_info()[1].ip return flask.render_template('error.html', error_message=error_message, slim=slim), 502 return flask.render_template('error.html', traceback=traceback.format_exc(), slim=slim), 500 |