fix: Default ProxyInfo port if httpx.URL port is None by steffansafey · Pull Request #619 · apify/crawlee-python
Fixes an issue where the string `:None` was being appended to Playwright Proxy configurations.
```
proxy_info: {'server': 'http://p.webshare.io:None', 'username': 'foo', 'password': 'bar'}
```
Neither Firefox or Chrome were able to use a URL like `http://foo:bar@p.webshare.io:80/`, because the :80 was being stripped off by HTTPX. `httpx.URL.port` cannot be set to 80 (for HTTP) or 443 (HTTPS), see example below.
This change explicitly sets the proxy port if it's unset.
```
In [1]: from httpx import URL
In [2]: url = URL(scheme="http", host="example.com", port=8080)
In [3]: url.port
Out[3]: 8080
In [4]: url = URL(scheme="http", host="example.com", port=80)
In [5]: url.port
In [6]: url = URL(scheme="http", host="example.com", port=443)
In [7]: url.port
Out[7]: 443
In [8]: url = URL(scheme="https", host="example.com", port=443)
In [9]: url.port
```