@@ -11,7 +11,7 @@ msgid ""
1111msgstr ""
1212"Project-Id-Version : Python 3.11\n "
1313"Report-Msgid-Bugs-To : \n "
14- "POT-Creation-Date : 2023-09-29 14:44 +0000\n "
14+ "POT-Creation-Date : 2023-10-06 14:42 +0000\n "
1515"PO-Revision-Date : 2023-05-24 02:11+0000\n "
1616"
Last-Translator :
Rafael Fontenelle <[email protected] >, 2023\n "
1717"Language-Team : Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n "
@@ -258,12 +258,16 @@ msgid ""
258258"response (though as usual with Python APIs, built-in exceptions such as "
259259":exc:`ValueError`, :exc:`TypeError` etc. may also be raised)."
260260msgstr ""
261+ "当 *urlopen* 无法处理响应信息时将会引发 :exc:`~urllib.error.URLError` (当然与 Python API "
262+ "通常的情况一样,也可能会引发如 :exc:`ValueError`, :exc:`TypeError` 之类的内置异常)。"
261263
262264#: ../../howto/urllib2.rst:201
263265msgid ""
264266":exc:`~urllib.error.HTTPError` is the subclass of "
265267":exc:`~urllib.error.URLError` raised in the specific case of HTTP URLs."
266268msgstr ""
269+ ":exc:`~urllib.error.HTTPError` 是在 HTTP URL 的特定情况下引发的 "
270+ ":exc:`~urllib.error.URLError` 的子类。"
267271
268272#: ../../howto/urllib2.rst:204
269273msgid ""
@@ -303,6 +307,11 @@ msgid ""
303307":exc:`~urllib.error.HTTPError`. Typical errors include '404' (page not "
304308"found), '403' (request forbidden), and '401' (authentication required)."
305309msgstr ""
310+ "来自服务器的每个 HTTP 响应都包含一个数字形式的“状态码”。 "
311+ "有时该状态码表明服务器无法完成请求。默认的处理句柄将会为你处理其中的部分响应(例如,当响应为要求客户端从另一 URL "
312+ "获取文档的“重定向”响应时,urllib 将为你处理该响应)。 对于无法处理的响应,urlopen 将会引发 "
313+ ":exc:`~urllib.error.HTTPError`。 典型的错误包括 \" 404\" (页面未找到)、\" 403\" (请求遭拒)和 "
314+ "\" 401\" (需要身份认证)等。"
306315
307316#: ../../howto/urllib2.rst:235
308317msgid ""
@@ -314,6 +323,7 @@ msgid ""
314323"The :exc:`~urllib.error.HTTPError` instance raised will have an integer "
315324"'code' attribute, which corresponds to the error sent by the server."
316325msgstr ""
326+ "被引发的 :exc:`~urllib.error.HTTPError` 实例将有一个整数形式的 'code' 属性,对应于服务器发送的错误信息。"
317327
318328#: ../../howto/urllib2.rst:241
319329msgid "Error Codes"
@@ -344,6 +354,9 @@ msgid ""
344354"attribute, it also has read, geturl, and info, methods as returned by the "
345355"``urllib.response`` module::"
346356msgstr ""
357+ "当错误被引发时服务器会通过返回 HTTP 错误码 *和* 错误页面进行响应。 你可以在返回的页面上使用 "
358+ ":exc:`~urllib.error.HTTPError` 实例作为响应。 这意味着除了 code 属性之外,它还像 "
359+ "``urllib.response`` 模块: 所返回对象那样具有 read, geturl 和 info 等方法::"
347360
348361#: ../../howto/urllib2.rst:339
349362msgid "Wrapping it Up"
@@ -355,6 +368,8 @@ msgid ""
355368":exc:`~urllib.error.URLError` there are two basic approaches. I prefer the "
356369"second approach."
357370msgstr ""
371+ "因此当你想为 :exc:`~urllib.error.HTTPError` *或* :exc:`~urllib.error.URLError` "
372+ "做好准备时有两种基本的方案。 我更倾向使用第二种方案。"
358373
359374#: ../../howto/urllib2.rst:345
360375msgid "Number 1"
@@ -365,6 +380,8 @@ msgid ""
365380"The ``except HTTPError`` *must* come first, otherwise ``except URLError`` "
366381"will *also* catch an :exc:`~urllib.error.HTTPError`."
367382msgstr ""
383+ "``except HTTPError`` *必须* 首先被处理,否则 ``except URLError`` 将会 *同时* 捕获 "
384+ ":exc:`~urllib.error.HTTPError`。"
368385
369386#: ../../howto/urllib2.rst:371
370387msgid "Number 2"
@@ -380,6 +397,8 @@ msgid ""
380397"instance) has two useful methods :meth:`info` and :meth:`geturl` and is "
381398"defined in the module :mod:`urllib.response`.."
382399msgstr ""
400+ "urlopen 返回的响应 (或 :exc:`~urllib.error.HTTPError` 实例) 包含两个有用的方法 :meth:`info` 和"
401+ " :meth:`geturl` 并且是在模块 :mod:`urllib.response` 中定义的。"
383402
384403#: ../../howto/urllib2.rst:398
385404msgid ""
0 commit comments