Skip to content

bagofstuff.url_tools

Utility code for dealing with URLs.

looks_webish

looks_webish(candidate: str) -> bool

Does a given string look like it might be a web-oriented URL?

Parameters:

Name Type Description Default

candidate

str

The candidate string to test.

required

Returns:

Type Description
bool

True if it might be a URL, False if not.

Note

This simply checks if a string looks like the sort of input you'd expect if you asked a common user to 'enter a URL'. It won't test if it's valid or anything like that; but it might be a good tool for looking at some text and going 'that might be a URL'.