Skip to content

Instantly share code, notes, and snippets.

@cthoyt
Created September 24, 2021 11:36
Show Gist options
  • Save cthoyt/3f899eae5304ea3b3316a3c1be3c5bfd to your computer and use it in GitHub Desktop.
Save cthoyt/3f899eae5304ea3b3316a3c1be3c5bfd to your computer and use it in GitHub Desktop.
Find URL format strings in the bioregistry with problematic trailing slashes
import tabulate
import bioregistry
def main():
"""Generate a curation sheet for URL format strings with problematic trailing slashes."""
rows = []
for prefix, resource in bioregistry.read_registry().items():
format_url = resource.get_format()
identifier = resource.get_example()
if format_url and format_url.endswith('/'):
rows.append((prefix, format_url, bioregistry.get_iri(prefix, identifier)))
print(tabulate.tabulate(rows, headers=["Prefix", "URL", "Example"]))
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment