Skip to content

Instantly share code, notes, and snippets.

@eyeseast
Created March 30, 2021 00:39
Show Gist options
  • Save eyeseast/bfcfa2a32e1b7599fcbec6d3f4818a8d to your computer and use it in GitHub Desktop.
Save eyeseast/bfcfa2a32e1b7599fcbec6d3f4818a8d to your computer and use it in GitHub Desktop.
from urllib.parse import urlparse
from datasette import hookimpl
def urlextract(uri, part):
u = urlparse(uri)
return getattr(u, part)
@hookimpl
def prepare_connection(conn):
conn.create_function("urlextract", 2, urlextract)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment