From aef68f323f16a0625995d4ffe6ae8015de3d061c Mon Sep 17 00:00:00 2001 From: peterdotran Date: Tue, 23 Aug 2016 17:55:51 -0700 Subject: [PATCH] Added attributes for URLError and HTTPError (#494) --- stdlib/2.7/urllib2.pyi | 9 ++++++--- stdlib/3/urllib/error.pyi | 10 ++++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/stdlib/2.7/urllib2.pyi b/stdlib/2.7/urllib2.pyi index 292bc2119..0ce8a7a9c 100644 --- a/stdlib/2.7/urllib2.pyi +++ b/stdlib/2.7/urllib2.pyi @@ -1,10 +1,13 @@ -from typing import AnyStr +from typing import AnyStr, Dict, Union from urllib import addinfourl -class URLError(IOError): ... +class URLError(IOError): + reason = ... # type: Union[str, BaseException] -class HTTPError(URLError, addinfourl): ... +class HTTPError(URLError, addinfourl): + code = ... # type: int + headers = ... # type: Dict[str, str] class Request(object): host = ... # type: str diff --git a/stdlib/3/urllib/error.pyi b/stdlib/3/urllib/error.pyi index 279296400..fe4dbb1b6 100644 --- a/stdlib/3/urllib/error.pyi +++ b/stdlib/3/urllib/error.pyi @@ -1,5 +1,11 @@ +from typing import Any, Dict, Union +from urllib.response import addinfourl + # Stubs for urllib.error -class URLError(IOError): ... -class HTTPError(URLError): ... +class URLError(IOError): + reason = ... # type: Union[str, BaseException] +class HTTPError(URLError, addinfourl): + code = ... # type: int + headers = ... # type: Dict[str, str] class ContentTooShortError(URLError): ...