Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Use test suffix in filenames also
  • Loading branch information
kthoden committed Sep 23, 2021
1 parent dcde1bd commit 7080e59
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions build_frontmatter.py
Expand Up @@ -876,13 +876,15 @@ def get_types_dict(pub_type):
testprefix = CONFIG["doi"]["testprefix"][1:-1]

if use_test_repo:
batch_filename = str(out_dir) + f"/{eoa_publication}_doiupload_test.sh"
test_repo_string = "_test"
doipublication = re.sub(r'(10\.[0-9]{4,})/',f'{testprefix}/', doipublication)
api_url = "https://api.test.datacite.org/dois"
else:
batch_filename = str(out_dir) + f"/{eoa_publication}_doiupload.sh"
test_repo_string = ""
api_url = "https://api.datacite.org/dois"

batch_filename = str(out_dir) + f"/{eoa_publication}_doiupload{test_repo_string}.sh"

curl_command = 'curl --verbose --netrc --request POST --header "Content-Type: application/vnd.api+json"'

chapter_files = get_chapters(eoa_pub_id, eoa_cursor, eoaclassic, include_pdfless=True)
Expand Down Expand Up @@ -1102,7 +1104,7 @@ def get_types_dict(pub_type):
json_dict = {"data" : data_dict}

json_object = json.dumps(json_dict)
json_file = out_dir / f"{eoa_publication}_chap{chaptercounter:02}.json"
json_file = out_dir / f"{eoa_publication}_chap{chaptercounter:02}{test_repo_string}.json"
write_json_file(json_object, json_file)
command_file.write(f"{curl_command} -d @{json_file} {api_url}\n")
chaptercounter += 1
Expand Down

0 comments on commit 7080e59

Please sign in to comment.