progress in removing core
This commit is contained in:
parent
4025983ca7
commit
26c3b519c7
@ -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
|
keydb.transportinfo.set_address_info(peer, 'lastConnectAttempt', epoch.get_epoch()) # mark the time we're trying to request this peer
|
||||||
try:
|
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:
|
except streamedrequests.exceptions.ResponseLimitReached:
|
||||||
logger.warn('Request failed due to max response size being overflowed', terminal=True)
|
logger.warn('Request failed due to max response size being overflowed', terminal=True)
|
||||||
retData = False
|
retData = False
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
'''
|
'''
|
||||||
import onionrplugins
|
import onionrplugins
|
||||||
|
API_VERSION = 0
|
||||||
def load_plugin_blueprints(flaskapp, blueprint='flask_blueprint'):
|
def load_plugin_blueprints(flaskapp, blueprint='flask_blueprint'):
|
||||||
'''Iterate enabled plugins and load any http endpoints they have'''
|
'''Iterate enabled plugins and load any http endpoints they have'''
|
||||||
for plugin in onionrplugins.get_enabled_plugins():
|
for plugin in onionrplugins.get_enabled_plugins():
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
'''
|
'''
|
||||||
import requests, streamedrequests
|
import requests, streamedrequests
|
||||||
import logger, onionrexceptions
|
import logger, onionrexceptions
|
||||||
|
import httpapi
|
||||||
def do_post_request(onionr_inst, url, data={}, port=0, proxyType='tor', max_size=10000):
|
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
|
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
|
retData = False
|
||||||
return retData
|
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
|
Do a get request through a local tor or i2p instance
|
||||||
'''
|
'''
|
||||||
if not ignoreAPI:
|
API_VERSION = httpapi.API_VERSION
|
||||||
if onionr_inst is None:
|
|
||||||
raise ValueError("Onionr inst must be set if ignoreAPI is False")
|
|
||||||
else:
|
|
||||||
API_VERSION = onionr_inst.API_VERSION
|
|
||||||
retData = False
|
retData = False
|
||||||
if proxyType == 'tor':
|
if proxyType == 'tor':
|
||||||
if port == 0:
|
if port == 0:
|
||||||
|
Loading…
Reference in New Issue
Block a user