Avoid monkeypatching PySocks

This commit is contained in:
tecnovert
2023-02-26 22:42:44 +02:00
parent f33629f2a5
commit 724e7f0ffc
3 changed files with 141 additions and 146 deletions

View File

@@ -1,11 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2019-2022 tecnovert
# Copyright (c) 2019-2023 tecnovert
# Distributed under the MIT software license, see the accompanying
# file LICENSE or http://www.opensource.org/licenses/mit-license.php.
import json
import urllib.request
class Explorer():
@@ -17,12 +16,7 @@ class Explorer():
def readURL(self, url):
self.log.debug('Explorer url: {}'.format(url))
try:
self.swapclient.setConnectionParameters()
req = urllib.request.Request(url)
return urllib.request.urlopen(req).read()
finally:
self.swapclient.popConnectionParameters()
return self.swapclient.readURL(url)
class ExplorerInsight(Explorer):