@@ -18,7 +18,7 @@ msgid ""
1818msgstr ""
1919"Project-Id-Version : Python 3.12\n "
2020"Report-Msgid-Bugs-To : \n "
21- "POT-Creation-Date : 2023-07-28 14:13 +0000\n "
21+ "POT-Creation-Date : 2023-09-29 14:12 +0000\n "
2222"PO-Revision-Date : 2021-06-28 00:53+0000\n "
2323"
Last-Translator :
Freesand Leo <[email protected] >, 2023\n "
2424"Language-Team : Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n "
@@ -261,18 +261,20 @@ msgstr "异常的处理"
261261
262262#: ../../howto/urllib2.rst:197
263263msgid ""
264- "*urlopen* raises :exc:`URLError` when it cannot handle a response (though as "
265- " usual with Python APIs, built-in exceptions such as :exc:`ValueError`, "
266- ":exc:`TypeError` etc. may also be raised)."
264+ "*urlopen* raises :exc:`~urllib.error. URLError` when it cannot handle a "
265+ "response (though as usual with Python APIs, built-in exceptions such as "
266+ ":exc:`ValueError`, :exc:` TypeError` etc. may also be raised)."
267267msgstr ""
268- "如果 *urlopen* 无法处理响应信息,就会触发 :exc:`URLError` 。尽管与通常的 Python API 一样,也可能触发 "
269- ":exc:`ValueError` 、 :exc:`TypeError` 等内置异常 。"
268+ "当 *urlopen* 无法处理响应信息时将会引发 :exc:`~urllib.error. URLError` (当然与 Python API "
269+ "通常的情况一样,也可能会引发如 :exc:`ValueError`, :exc:`TypeError` 之类的内置异常) 。"
270270
271271#: ../../howto/urllib2.rst:201
272272msgid ""
273- ":exc:`HTTPError` is the subclass of :exc:`URLError` raised in the specific "
274- "case of HTTP URLs."
275- msgstr ":exc:`HTTPError` 是 :exc:`URLError` 的子类,当 URL 是 HTTP 的情况时将会触发。"
273+ ":exc:`~urllib.error.HTTPError` is the subclass of "
274+ ":exc:`~urllib.error.URLError` raised in the specific case of HTTP URLs."
275+ msgstr ""
276+ ":exc:`~urllib.error.HTTPError` 是在 HTTP URL 的特定情况下引发的 "
277+ ":exc:`~urllib.error.URLError` 的子类。"
276278
277279#: ../../howto/urllib2.rst:204
278280msgid ""
@@ -308,14 +310,15 @@ msgid ""
308310"request. The default handlers will handle some of these responses for you "
309311"(for example, if the response is a \" redirection\" that requests the client "
310312"fetch the document from a different URL, urllib will handle that for you). "
311- "For those it can't handle, urlopen will raise an :exc:`HTTPError`. Typical "
312- "errors include '404' (page not found), '403' (request forbidden), and '401' "
313- "(authentication required)."
313+ "For those it can't handle, urlopen will raise an "
314+ ":exc:`~urllib.error.HTTPError`. Typical errors include '404' (page not "
315+ "found), '403' (request forbidden), and '401' (authentication required)."
314316msgstr ""
315- "从服务器返回的每个 HTTP 响应都包含一个数字的 "
316- "“状态码”。有时该状态码表明服务器无法完成该请求。默认的处理函数将会处理这其中的一部分响应。如若响应是“redirection”,这是要求客户端从另一 "
317- "URL 处获取数据,urllib 将会自行处理。对于那些无法处理的状况,urlopen 将会引发 :exc:`HTTPError` "
318- "。典型的错误包括:“404”(页面无法找到)、“403”(请求遭拒绝)和“401”(需要身份认证)。"
317+ "来自服务器的每个 HTTP 响应都包含一个数字形式的“状态码”。 "
318+ "有时该状态码表明服务器无法完成请求。默认的处理句柄将会为你处理其中的部分响应(例如,当响应为要求客户端从另一 URL "
319+ "获取文档的“重定向”响应时,urllib 将为你处理该响应)。 对于无法处理的响应,urlopen 将会引发 "
320+ ":exc:`~urllib.error.HTTPError`。 典型的错误包括 \" 404\" (页面未找到)、\" 403\" (请求遭拒)和 "
321+ "\" 401\" (需要身份认证)等。"
319322
320323#: ../../howto/urllib2.rst:235
321324msgid ""
@@ -324,9 +327,9 @@ msgstr "全部的 HTTP 错误码请参阅 :rfc:`2616` 。"
324327
325328#: ../../howto/urllib2.rst:237
326329msgid ""
327- "The :exc:`HTTPError` instance raised will have an integer 'code' attribute, "
328- "which corresponds to the error sent by the server."
329- msgstr ":exc:`HTTPError` 实例将包含一个整数型的“code”属性,对应于服务器发来的错误。 "
330+ "The :exc:`~urllib.error. HTTPError` instance raised will have an integer "
331+ "'code' attribute, which corresponds to the error sent by the server."
332+ msgstr ""
330333
331334#: ../../howto/urllib2.rst:241
332335msgid "Error Codes"
@@ -352,23 +355,22 @@ msgstr ""
352355#: ../../howto/urllib2.rst:319
353356msgid ""
354357"When an error is raised the server responds by returning an HTTP error code "
355- "*and* an error page. You can use the :exc:`HTTPError` instance as a response "
356- " on the page returned. This means that as well as the code attribute, it "
357- "also has read, geturl, and info, methods as returned by the "
358+ "*and* an error page. You can use the :exc:`~urllib.error. HTTPError` instance"
359+ " as a response on the page returned. This means that as well as the code "
360+ "attribute, it also has read, geturl, and info, methods as returned by the "
358361"``urllib.response`` module::"
359362msgstr ""
360- "当触发错误时,服务器通过返回 HTTP 错误码 *和* 错误页面进行响应。可以将 :exc:`HTTPError` 实例用作返回页面的响应。这意味着除了"
361- " code 属性之外,错误对象还像 ``urllib.response`` 模块返回的那样具有 read、geturl 和 info 方法:"
362363
363364#: ../../howto/urllib2.rst:339
364365msgid "Wrapping it Up"
365366msgstr "总之"
366367
367368#: ../../howto/urllib2.rst:341
368369msgid ""
369- "So if you want to be prepared for :exc:`HTTPError` *or* :exc:`URLError` "
370- "there are two basic approaches. I prefer the second approach."
371- msgstr "若要准备处理 :exc:`HTTPError` *或* :exc:`URLError` ,有两种简单的方案。推荐使用第二种方案。"
370+ "So if you want to be prepared for :exc:`~urllib.error.HTTPError` *or* "
371+ ":exc:`~urllib.error.URLError` there are two basic approaches. I prefer the "
372+ "second approach."
373+ msgstr ""
372374
373375#: ../../howto/urllib2.rst:345
374376msgid "Number 1"
@@ -377,10 +379,8 @@ msgstr "第一种方案"
377379#: ../../howto/urllib2.rst:367
378380msgid ""
379381"The ``except HTTPError`` *must* come first, otherwise ``except URLError`` "
380- "will *also* catch an :exc:`HTTPError`."
382+ "will *also* catch an :exc:`~urllib.error. HTTPError`."
381383msgstr ""
382- "``except HTTPError`` *必须* 首先处理,否则 ``except URLError`` 将会 *同时* 捕获 "
383- ":exc:`HTTPError` 。"
384384
385385#: ../../howto/urllib2.rst:371
386386msgid "Number 2"
@@ -392,12 +392,10 @@ msgstr "info 和 geturl 方法"
392392
393393#: ../../howto/urllib2.rst:394
394394msgid ""
395- "The response returned by urlopen (or the :exc:`HTTPError` instance) has two "
396- "useful methods :meth:`info` and :meth:`geturl` and is defined in the module "
397- ":mod:`urllib.response`.."
395+ "The response returned by urlopen (or the :exc:`~urllib.error. HTTPError` "
396+ "instance) has two useful methods :meth:`info` and :meth:`geturl` and is "
397+ "defined in the module :mod:`urllib.response`.."
398398msgstr ""
399- "由 urlopen (或者 :exc:`HTTPError` 实例)所返回的响应包含两个有用的方法: :meth:`info` 和 "
400- ":meth:`geturl`,该响应由模块 :mod:`urllib.response` 定义。"
401399
402400#: ../../howto/urllib2.rst:398
403401msgid ""
0 commit comments