From aee561335a2db179074ee00b65fdcbc931f8dca6 Mon Sep 17 00:00:00 2001 From: Jover Date: Thu, 24 Aug 2023 16:19:22 -0700 Subject: [PATCH] fetch-from-ncbi-virus: Add github_repo argument Add github_repo argument to allow customization of the User-Agent request header. Following the pattern of other scripts in this repo that requires the repo owner and name. --- fetch-from-ncbi-virus | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fetch-from-ncbi-virus b/fetch-from-ncbi-virus index 7c4905b..0c5f3e5 100755 --- a/fetch-from-ncbi-virus +++ b/fetch-from-ncbi-virus @@ -1,5 +1,5 @@ #!/bin/bash -# usage: fetch-from-ncbi-virus [options] +# usage: fetch-from-ncbi-virus [options] # # Fetch metadata and nucleotide sequences from [NCBI Virus](https://www.ncbi.nlm.nih.gov/labs/virus/vssi/#/) # and output NDJSON records to stdout. @@ -38,16 +38,18 @@ main() { done local ncbi_taxon_id="${1:?NCBI taxon id is required.}" + local github_repo="${2:?A GitHub repository with owner and repository name is required as the second argument}" + local ncbi_virus_url ncbi_virus_url="$("$bin"/ncbi-virus-url --ncbi-taxon-id "$ncbi_taxon_id" --filters "${filters[@]}" --fields "${fields[@]}")" - fetch "$ncbi_virus_url" | "$bin"/csv-to-ndjson + fetch "$ncbi_virus_url" "$github_repo" | "$bin"/csv-to-ndjson } fetch() { curl "$1" \ --fail --silent --show-error --http1.1 \ - --header 'User-Agent: https://github.com/nextstrain/monkeypox (hello@nextstrain.org)' + --header "User-Agent: https://github.com/$2 (hello@nextstrain.org)" } main "$@"