Objective
URLs have a precise structure, and splitting them with split or with home-made regular expressions is a classic source of bugs and security flaws. urllib.parse.urlparse does it properly, and parse_qsl decodes the parameters (including %20 and +).
Instructions
- The input is a line with a URL.
- Show
Scheme: ...,Host: ...,Port: ...(or-if there is none),Path: ...(or/if empty) and then aParameter: key=valuefor each query parameter, sorted.
https://ejemplo.com:8443/buscar?q=python&pagina=2
Scheme: https
Host: ejemplo.com
Port: 8443
Path: /buscar
Parameter: pagina=2
Parameter: q=python
Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.
Start exercise