From 26c3b519c70fe93418aa71b37eecab4970bd3e9c Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Sun, 21 Jul 2019 21:23:22 -0500 Subject: [PATCH] progress in removing core --- onionr/communicator/peeraction.py | 2 +- onionr/httpapi/__init__.py | 2 +- onionr/onionrutils/basicrequests.py | 9 +++------ 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/onionr/communicator/peeraction.py b/onionr/communicator/peeraction.py index dc4fa9bf..fc982fe7 100644 --- a/onionr/communicator/peeraction.py +++ b/onionr/communicator/peeraction.py @@ -33,7 +33,7 @@ def peer_action(comm_inst, peer, action, data='', returnHeaders=False, max_resp_ keydb.transportinfo.set_address_info(peer, 'lastConnectAttempt', epoch.get_epoch()) # mark the time we're trying to request this peer try: - retData = basicrequests.do_get_request(comm_inst.onionrInst, url, port=comm_inst.proxyPort, max_size=max_resp_size) + retData = basicrequests.do_get_request( url, port=comm_inst.proxyPort, max_size=max_resp_size) except streamedrequests.exceptions.ResponseLimitReached: logger.warn('Request failed due to max response size being overflowed', terminal=True) retData = False diff --git a/onionr/httpapi/__init__.py b/onionr/httpapi/__init__.py index b3d6c3b3..f21c261b 100755 --- a/onionr/httpapi/__init__.py +++ b/onionr/httpapi/__init__.py @@ -18,7 +18,7 @@ along with this program. If not, see . ''' import onionrplugins - +API_VERSION = 0 def load_plugin_blueprints(flaskapp, blueprint='flask_blueprint'): '''Iterate enabled plugins and load any http endpoints they have''' for plugin in onionrplugins.get_enabled_plugins(): diff --git a/onionr/onionrutils/basicrequests.py b/onionr/onionrutils/basicrequests.py index f0415200..d3d29129 100644 --- a/onionr/onionrutils/basicrequests.py +++ b/onionr/onionrutils/basicrequests.py @@ -19,6 +19,7 @@ ''' import requests, streamedrequests import logger, onionrexceptions +import httpapi def do_post_request(onionr_inst, url, data={}, port=0, proxyType='tor', max_size=10000): ''' Do a POST request through a local tor or i2p instance @@ -44,15 +45,11 @@ def do_post_request(onionr_inst, url, data={}, port=0, proxyType='tor', max_size retData = False return retData -def do_get_request(url, port=0, proxyType='tor', ignoreAPI=False, returnHeaders=False, max_size=5242880, onionr_inst=None): +def do_get_request(url, port=0, proxyType='tor', ignoreAPI=False, returnHeaders=False, max_size=5242880): ''' Do a get request through a local tor or i2p instance ''' - if not ignoreAPI: - if onionr_inst is None: - raise ValueError("Onionr inst must be set if ignoreAPI is False") - else: - API_VERSION = onionr_inst.API_VERSION + API_VERSION = httpapi.API_VERSION retData = False if proxyType == 'tor': if port == 0: