🔍

urllib.o

Helps in processing URL strings

Main elements

Name Description / comments
urllib.parse[<url string>] Return a dictionary with parsed URL
urllib.href[<url dict>] Return URL string
urllib.encode[<x>] Encode into a format that can be transmitted over the internet
urllib.decode[<x>] Decode from format with "%" and whitespace as "+"

Examples:

o)load "urllib";
o)urllib.parse["https://tester@dazzle.com:8080"]
protocol| "https"
user    | "tester"
password| 0N0
host    | "dazzle.com"
port    | 8080
path    | 0N0
query   | 0N0
fragment| 0N0
o)urllib.href[`protocol`host`port!("http";"127.0.0.1";8080)]
"http://127.0.0.1:8080"
o)urllib.decode "http://localhost:8080/?submitted-name=adf+qe+sdfg+%2B+h"
"http://localhost:8080/?submitted-name=adf qe sdfg + h"

Auxiliary elements

Name Description / comments
urllib.protocol[<x>] Return field `protocol
urllib.user[<x>] Return field `user
urllib.password[<x>] Return field `password
urllib.host[<x>] Return field `host
urllib.port[<x>] Return field `port
urllib.path[<x>] Return field `path
urllib.query[<x>] Return field `query
urllib.fragment[<x>] Return field `fragment
urllib.update[<x>] Update URL dictionary with dictionary x
urllib.test[] Run tests for all elements of the library
urllib.examples[] Show use cases