w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
python-requests returning unicode Exception message (or how to set requests locale)

You can try os.strerror, but it would probably return nothing or the same non-English string.

This hard-coded English was scraped from here: http://support.microsoft.com/kb/819124

ENGLISH_WINDOWS_SOCKET_MESSAGES = {
    10004: "Interrupted function call.",
    10013: "Permission denied.",
    10014: "Bad address.",
    10022: "Invalid argument.",
    10024: "Too many open files.",
    10035: "Resource temporarily unavailable.",
    10036: "Operation now in progress.",
    10037: "Operation already in progress.",
    10038: "Socket operation on nonsocket.",
    10039: "Destination address required.",
    10040: "Message too long.",
    10041: "Protocol wrong type for socket.",
    10042: "Bad protocol option.",
    10043: "Protocol not supported.",
    10044: "Socket type not supported.",
    10045: "Operation not supported.",
    10046: "Protocol family not supported.",
    10047: "Address family not supported by protocol family.",
    10048: "Address already in use.",
    10049: "Cannot assign requested address.",
    10050: "Network is down.",
    10051: "Network is unreachable.",
    10052: "Network dropped connection on reset.",
    10053: "Software caused connection abort.",
    10054: "Connection reset by peer.",
    10055: "No buffer space available.",
    10056: "Socket is already connected.",
    10057: "Socket is not connected.",
    10058: "Cannot send after socket shutdown.",
    10060: "Connection timed out.",
    10061: "Connection refused.",
    10064: "Host is down.",
    10065: "No route to host.",
    10067: "Too many processes.",
    10091: "Network subsystem is unavailable.",
    10092: "Winsock.dll version out of range.",
    10093: "Successful WSAStartup not yet performed.",
    10101: "Graceful shutdown in progress.",
    10109: "Class type not found.",
    11001: "Host not found. No such host is known.",
    11002: "Nonauthoritative host not found.",
    11003: "This is a nonrecoverable error.",
    11004: "Valid name, no data record of requested type.",
}

(For future scrapers: The following xpaths were used: //div[@id="MT1"]//h3 and following-sibling::ul/li)





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.