-
Notifications
You must be signed in to change notification settings - Fork 1
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
Implemented produce-clt-manifest arguments into search, search with index, and param search #64
Implemented produce-clt-manifest arguments into search, search with index, and param search #64
Conversation
…ndex, and param search
src/app.py
Outdated
@@ -247,6 +248,56 @@ def search(self): | |||
,query=None | |||
,request_params=None | |||
,large_response_settings_dict=self.S3_settings_dict) | |||
generate_manifest = False | |||
accepted_s3_domains = ["hm-api-responses.s3.amazonaws.com"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't hardcode this. In search-api's app.cfg
there's this AWS_S3_BUCKET_NAME
config.
See the review comment below, when we use 303 status code for the check, no longer need this.
src/app.py
Outdated
if generate_manifest is True: | ||
content_type = response.content_type | ||
content_data = response.get_data(as_text=True) | ||
if content_type.startswith("text/html"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checking the MIME type of response is not a reliable approach. Instead, use the status code. It'll be 303 when a S3 URL gets returned. This also eliminates the use of AWS_S3_BUCKET_NAME
stated above.
src/app.py
Outdated
if "status" in output_json: | ||
return output | ||
if "aggs" in request.json: | ||
return make_response(jsonify("if parameter produce-clt-manifest is included, may not use 'aggs' in request body."), 422) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Capitalize the beginning word "if"
|
||
accepted_s3_domains = ["hm-api-responses.s3.amazonaws.com"] | ||
|
||
manifest_list = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Due to the fact that multiple search endpoints use the same handling for manifest file generation, we should create a shared method rather than repeating the code.
…, normalized some capitalization, use status codes 303 instead of checking content type
…y_type is returned by the query
No description provided.