Python
Ada has a Python client available on Github.
For more details on the ada_url API, see the documentation at Read the Docs.
Installation
Section titled “Installation”Installing pre-built binary wheels
Section titled “Installing pre-built binary wheels”The easiest way to get started is to install ada-url from PyPI.
From within your virtual environment, run:
python3 -m pip install ada-urlInstalling from source
Section titled “Installing from source”The Makefile in the project root will build a package for installation on your own machine.
From within your virtual environment, run:
-
Prepare
Terminal window make requirements package -
Install
Terminal window python3 -m install -e .
URL class
Section titled “URL class”The ada_url package defines a URL class that can parse URLs:
>>> import ada_url>>> urlobj = ada_url.URL('https://example.org/path/file.txt')>>> urlobj.protocol'https:'>>> urlobj.pathname'/path/file.txt'High-level functions
Section titled “High-level functions”It also exposes some higher level functions for analyzing and manipulating URLs:
parse_url
Section titled “parse_url”>>> import ada_url>>> ada_url.parse_url('https://user:pass@example.org:80/api?q=1#2'){ 'href': 'https://user:pass@example.org:80/api?q=1#2', 'username': 'user', 'password': 'pass', 'protocol': 'https:', 'host': 'example.org:80', 'port': '80', 'hostname': 'example.org', 'pathname': '/api', 'search': '?q=1', 'hash': '#2'}join_url
Section titled “join_url”>>> import ada_url>>> ada_url.join_url('https://example.org/dir/child.txt', '../parent.txt')