Skip to content

TOLid add  #3

@molikd

Description

@molikd

We should check if the TOL id actually exists for the validator:

import requests

def get_matching_line(url, match_string):
    # Download the file from the URL
    response = requests.get(url)
    response.raise_for_status()  # Ensure the request was successful
    
    # Split the content into lines
    lines = response.text.splitlines()
    
    for line in lines:
        # Split the line into columns (assuming tab-delimited)
        columns = line.split('\t')
        # Check if the first column matches the input string
        if columns[0] == match_string:
            return line  # Return the whole line if a match is found
    
    return None  # Return None if no match is found

# URL of the file
url = "https://gitlab.com/wtsi-grit/darwin-tree-of-life-sample-naming/-/raw/master/tolids.txt?ref_type=heads"
match_string = "desired_value"  # Replace with the value you're looking for

# Get the matching line
result = get_matching_line(url, match_string)

if result:
    print("Matching line:", result)
else:
    print("No match found.")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions