---
name: normalize_url
kind: function
lang: py
domain: cybersecurity
version: "1.0.0"
purity: pure
signature: "def normalize_url(raw_url: str) -> str"
description: "Normaliza una URL: lowercase del host, elimina fragmentos, ordena parametros. Util para deduplicacion de IoCs."
tags: [url, normalize, ioc, dedup, python]
uses_functions: []
uses_types: []
returns: []
returns_optional: false
error_type: ""
imports: [urllib.parse]
params:
  - name: raw_url
    desc: "URL en formato string a normalizar"
output: "URL normalizada con host en minusculas, fragmentos eliminados y parametros ordenados"
tested: false
tests: []
test_file_path: ""
file_path: "python/functions/cybersecurity/cybersecurity.py"
---

## Ejemplo

```python
normalize_url("HTTPS://Example.COM/path?b=2&a=1#frag")
# "https://example.com/path?a=1&b=2"

normalize_url("http://test.org/path/")
# "http://test.org/path"
```

## Notas

Operaciones de normalizacion: lowercase de scheme y host, eliminacion de trailing slash (excepto root), ordenamiento alfabetico de query parameters, eliminacion de fragmentos. Usa urllib.parse de stdlib.
