PyJSONProxy

simple proxy and scraper
git clone https://git.ce9e.org/PyJSONProxy.git

commit
7883fbe7bb81be831936a435551ecbbb3a769815
parent
34413c3e322b6d4de7b17ea4665e9f6019f0e72e
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2017-06-03 09:42
do not pass HEAD/OPTIONS requests to upstream

Diffstat

M jsonproxy/__init__.py 6 ++----

1 files changed, 2 insertions, 4 deletions


diff --git a/jsonproxy/__init__.py b/jsonproxy/__init__.py

@@ -51,7 +51,7 @@ async def _request(method, url):
   51    51 			return response
   52    52 
   53    53 
   54    -1 @app.route('/{endpoint}/{path:.+}', methods=['GET', 'HEAD', 'OPTIONS'])
   -1    54 @app.route('/{endpoint}/{path:.+}')
   55    55 async def handle(request):
   56    56 	endpoint = request.match_info['endpoint']
   57    57 
@@ -67,10 +67,8 @@ async def handle(request):
   67    67 	remote = await _request(request.method, url)
   68    68 	body = await remote.read()
   69    69 
   70    -1 	if 'fields' in config and request.method == 'GET':
   -1    70 	if 'fields' in config:
   71    71 		response = jsonify(scrape(url, body, config), status=remote.status)
   72    -1 	else:
   73    -1 		response = make_response((body, remote.status, []))
   74    72 
   75    73 	if app.config.get('ALLOW_CORS', False):
   76    74 		response.headers['Access-Control-Allow-Origin'] = '*'