@app.route('/proxy')
def handle_proxy():
  request_url = request.args.get('url', '')
  callback = request.args.get('callback', '')
  request_parsed = urlparse.urlparse(request_url)

  # Check to make sure we have the right sort of request
  if not request_url or not callback:
    abort(404)

  # Check if valid proxy url
  if not is_valid_url(request_parsed):
    abort(404)

  # Get value from proxied url (this is the cached part)
  proxy_request = make_proxy(request_url)
  if proxy_request['status_code'] != requests.codes.ok:
    abort(proxy_request['status_code'])

  # Wrap callback
  proxy_request['text'] = '%s(%s);' % (callback, proxy_request['text'])

  # Override some headers
  proxy_request['headers'] = dict(proxy_request['headers'].items() + jsonp_header_overrides.items())

  # Remove some that may cause issues
  if 'content-length' != proxy_request['headers']:
    del proxy_request['headers']['content-length']
  if 'content-encoding' in proxy_request['headers']:
    del proxy_request['headers']['content-encoding']

  # Return our response
  return Response(proxy_request['text'], proxy_request['status_code'], proxy_request['headers'])


# Get proxy URL and cache the results
dataset/ETHPy150Open MinnPost/jsonproxy/app.py/handle_proxy/operator `in` -> `!=`