Is there a standard generic URI handler in Python?

Viewed 325

Typically, an URI (Universal Resource Identifier) can be:

  • a local or remote file
  • a web URL
  • a binary stream

What is the standard way to manage this in Python?

Something like:

uri = URI("whatever_URI)

In the Java world for example you've got the class java.net.URI.

1 Answers

You can use the 'uri' library of PyPI(Python Package Index:- it is like a repository of Python Packages).

• Install it using:

pip install uri

For MAC use:

pip3 install uri

• Use it like below

from uri import URI
home = URI("https://github.com/marrow/")
print(home)

For more information, You can visit this: https://pypi.org/project/uri/

Related