Search notes:

python standard library: urllib.parse

from urllib.parse import parse_qs
from urllib.parse import urlparse

url = 'https://server.tld/path/to/resource;par?value-one=foo&value-two=bar&value-two=baz#xyz'

parsed = urlparse(url)

print(f'scheme:   {parsed.scheme  }') # https
print(f'netloc:   {parsed.netloc  }') # server.tld
print(f'path:     {parsed.path    }') # /path/to/resource
print(f'params:   {parsed.params  }') # par
print(f'query:    {parsed.query   }') # value-one=foo&value-two=bar&value-two=baz
print(f'fragment: {parsed.fragment}') # xyz
print('')

values = parse_qs(parsed.query)
print(values['value-one']) # ['foo']
print(values['value-two']) # ['bar', 'baz']

print(values.get('unobtainium', ['n/a'])[0]) # n/a
Note: the values in the dict returned by parse_qs are lists!

See also

standard library

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1745044057, '18.191.66.218', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/languages/Python/standard-library/urllib/parse/index(57): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78