Skip to content

Commit

Permalink
Add standard library urllib
Browse files Browse the repository at this point in the history
  • Loading branch information
remisalmon committed Oct 6, 2023
1 parent 070180e commit 7715476
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Standard library
- [socket](#socket)
- [subprocess](#subprocess)
- [telnetlib](#telnetlib)
- [urllib](#urllib)

PyPI

Expand Down Expand Up @@ -125,6 +126,15 @@ Telnet(host, timeout=1)

Raises `socket.timeout`

### urllib

```python
req = Request(url)
urlopen(req, timeout=1)
```

Raises `urllib.error.URLError`

## PyPI

### aiohttp
Expand Down
10 changes: 10 additions & 0 deletions tests/test_urllib.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from .conftest import TestTimeouts
from urllib.request import Request, urlopen
from urllib.error import URLError


class TestRequests(TestTimeouts):
def test_urlopen(self):
with self.raises(URLError):
req = Request(self.connect_url())
urlopen(req, timeout=1)

0 comments on commit 7715476

Please sign in to comment.