progress in removing core

master
Kevin Froman 2019-07-21 21:23:22 -05:00
parent 4025983ca7
commit 26c3b519c7
3 changed files with 5 additions and 8 deletions

View File

@ -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

View File

@ -18,7 +18,7 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
'''
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():

View File

@ -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: