DOI Upload Script
import thothlibraryimport csv
# Log in to Thothemail = "XXX@punctumbooks.com" # Replace with your emailpassword = "XXX" # Replace with your password
thoth = thothlibrary.ThothClient()thoth.login(email, password)
# Define the work_id (this should be specific to the work you're uploading references for)work_id = "6244a086-636e-4756-bf5e-f803a78ffbc4" # Replace with the actual work_id
# Path to your CSV file containing the DOI datacsv_file_path = "0446.1.00_2025-02-04_11-33-41_dois.csv" # Replace with your CSV file path
# Read and process the CSV filewith open(csv_file_path, mode='r', newline='', encoding='utf-8') as file: reader = csv.reader(file)
for row in reader: if row: # Ensure the row is not empty reference_ordinal = row[0] # First column: reference ordinal doi = row[1] # Second column: DOI
# Construct the reference dictionary reference = { "workId": work_id, "referenceOrdinal": reference_ordinal, "doi": doi, "unstructuredCitation": None, "issn": None, "isbn": None, "journalTitle": None, "articleTitle": None, "seriesTitle": None, "volumeTitle": None, "edition": None, "author": None, "volume": None, "issue": None, "firstPage": None, "componentNumber": None, "standardDesignator": None, "standardsBodyName": None, "standardsBodyAcronym": None, "url": None, "publicationDate": None, "retrievalDate": None, }
# Upload the reference to Thoth and get the reference ID reference_id = thoth.create_reference(reference) print(f"Reference ID for DOI {doi}: {reference_id}")