Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

load-frontend-fits-file-uri #708

Merged
merged 8 commits into from
Sep 4, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions cdci_data_analysis/flask_app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import string
import random
import hashlib

import requests
import validators
import re
import logging
Expand Down Expand Up @@ -535,6 +537,33 @@
return redirect(location, 302)


@app.route('/load-frontend-fits-file-uri')
def load_frontend_file_uri():
par_dic = request.values.to_dict()
sanitized_request_values = sanitize_dict_before_log(par_dic)
logger.info('\033[32m===========================> load_frontend_file_uri\033[0m')

logger.info('\033[33m raw request values: %s \033[0m', dict(sanitized_request_values))

token = par_dic.pop('token', None)
app_config = app.config.get('conf')
secret_key = app_config.secret_key
output, output_code = tokenHelper.validate_token_from_request(token=token, secret_key=secret_key,
required_roles=['gallery contributor'],
action="post on the product gallery")

if output_code is not None:
return make_response(output, output_code)

url_to_request = request.values.get('url_request', None)

if url_to_request is not None:
response = requests.get(url_to_request)
Fixed Show fixed Hide fixed
return Response(response.content, status=response.status_code, mimetype='application/octet-stream')
else:
raise MissingRequestParameter("url_request not provided")


@app.route('/call_back', methods=['POST', 'GET'])
def dataserver_call_back():
sanitized_request_values = sanitize_dict_before_log(request.values)
Expand Down
Loading