urllib’s design is just... old school. For python3 get response code from urllib, you’re stuck with `getcode()` or digging into exceptions. Annoying, but that’s how it is.
If you’re just checking URLs, maybe use `curl` in a subprocess?
```python
import subprocess
result = subprocess.run(['curl', '-s', '-o', '/dev/null', '-w', '%{http_code}', 'https://example.com'], capture_output=True, text=True)
print(result.stdout)
```
Overkill? Maybe. Works? Absolutely.
If you’re just checking URLs, maybe use `curl` in a subprocess?
```python
import subprocess
result = subprocess.run(['curl', '-s', '-o', '/dev/null', '-w', '%{http_code}', 'https://example.com'], capture_output=True, text=True)
print(result.stdout)
```
Overkill? Maybe. Works? Absolutely.
