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

Implemented produce-clt-manifest arguments into search, search with index, and param search #64

Merged
merged 4 commits into from
Jul 16, 2024

Conversation

DerekFurstPitt
Copy link
Contributor

No description provided.

@DerekFurstPitt DerekFurstPitt requested a review from yuanzhou as a code owner July 10, 2024 02:10
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"]
Copy link
Member

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"):
Copy link
Member

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)
Copy link
Member

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 = []
Copy link
Member

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.

@yuanzhou yuanzhou merged commit 090adf5 into dev-integrate Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants