Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a460632

Browse files
[po] auto sync
1 parent 004f8da commit a460632

1 file changed

Lines changed: 25 additions & 17 deletions

File tree

howto/urllib2.po

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
# Translators:
77
# Jerry Chen <[email protected]>, 2017
88
# Fei Yin <[email protected]>, 2018
9-
# Junkai Shao <[email protected]>, 2018
109
# Kade For, 2019
1110
# 钢 彭 <[email protected]>, 2019
1211
# 汪心禾 <[email protected]>, 2019
@@ -225,17 +224,17 @@ msgstr "做法如下所示:"
225224
msgid ""
226225
"Notice that the full URL is created by adding a ``?`` to the URL, followed "
227226
"by the encoded values."
228-
msgstr ""
227+
msgstr "请注意,完整的 URL 是通过在其中添加 ``?`` 创建的,后面跟着经过编码的数据。"
229228

230229
#: ../../howto/urllib2.rst:165
231230
msgid "Headers"
232-
msgstr ""
231+
msgstr "HTTP 头部信息"
233232

234233
#: ../../howto/urllib2.rst:167
235234
msgid ""
236235
"We'll discuss here one particular HTTP header, to illustrate how to add "
237236
"headers to your HTTP request."
238-
msgstr ""
237+
msgstr "下面介绍一个具体的 HTTP 头部信息,以此说明如何在 HTTP 请求加入头部信息。 "
239238

240239
#: ../../howto/urllib2.rst:170
241240
msgid ""
@@ -249,35 +248,42 @@ msgid ""
249248
"the same request as above, but identifies itself as a version of Internet "
250249
"Explorer [#]_. ::"
251250
msgstr ""
251+
"有些网站 [#]_ 不愿被程序浏览到,或者要向不同的浏览器发送不同版本 [#]_ 的网页。默认情况下,urllib 将自身标识为“Python-"
252+
"urllib/xy”(其中 ``x`` 、 ``y`` 是 Python 版本的主、次版本号,例如 ``Python-"
253+
"urllib/2.5``),这可能会让网站不知所措,或者干脆就使其无法正常工作。浏览器是通过头部信息 ``User-Agent`` [#]_ "
254+
"来标识自己的。在创建 Request 对象时,可以传入字典形式的头部信息。以下示例将生成与之前相同的请求,只是将自身标识为某个版本的 Internet "
255+
"Explorer [#]_ :"
252256

253257
#: ../../howto/urllib2.rst:197
254258
msgid ""
255259
"The response also has two useful methods. See the section on `info and "
256260
"geturl`_ which comes after we have a look at what happens when things go "
257261
"wrong."
258-
msgstr ""
262+
msgstr "响应对象也有两个很有用的方法。请参阅有关 `info 和 geturl`_ 部分,了解出现问题时会发生什么。 "
259263

260264
#: ../../howto/urllib2.rst:202
261265
msgid "Handling Exceptions"
262-
msgstr "处理异常"
266+
msgstr "异常的处理"
263267

264268
#: ../../howto/urllib2.rst:204
265269
msgid ""
266270
"*urlopen* raises :exc:`URLError` when it cannot handle a response (though as"
267271
" usual with Python APIs, built-in exceptions such as :exc:`ValueError`, "
268272
":exc:`TypeError` etc. may also be raised)."
269273
msgstr ""
274+
"如果 *urlopen* 无法处理响应信息,就会触发 :exc:`URLError` 。尽管与通常的 Python API 一样,也可能触发 "
275+
":exc:`ValueError` 、 :exc:`TypeError` 等内置异常。"
270276

271277
#: ../../howto/urllib2.rst:208
272278
msgid ""
273279
":exc:`HTTPError` is the subclass of :exc:`URLError` raised in the specific "
274280
"case of HTTP URLs."
275-
msgstr ""
281+
msgstr ":exc:`HTTPError` 是 :exc:`URLError` 的子类,当 URL 是 HTTP 的情况时将会触发。"
276282

277283
#: ../../howto/urllib2.rst:211
278284
msgid ""
279285
"The exception classes are exported from the :mod:`urllib.error` module."
280-
msgstr "异常类从 :mod:`urllib.error` 模块中导出。"
286+
msgstr "上述异常类是从 :mod:`urllib.error` 模块中导出的。"
281287

282288
#: ../../howto/urllib2.rst:214
283289
msgid "URLError"
@@ -290,12 +296,12 @@ msgid ""
290296
"case, the exception raised will have a 'reason' attribute, which is a tuple "
291297
"containing an error code and a text error message."
292298
msgstr ""
293-
"通常,引发 URLError 的原因是没有网络连接(或者没有到指定服务器的路由),或者指定的服务器不存在。该情况下,将会引发该异常,并带有一个 "
294-
"'reason' 属性,该属性是一个包含错误代码和文本错误信息的元组。"
299+
"触发 URLError 的原因,通常是网络不通(或者没有到指定服务器的路由),或者指定的服务器不存在。这时触发的异常会带有一个 reason "
300+
"属性,是一个包含错误代码和文本错误信息的元组。"
295301

296302
#: ../../howto/urllib2.rst:221
297303
msgid "e.g. ::"
298-
msgstr "例如 ::"
304+
msgstr "例如"
299305

300306
#: ../../howto/urllib2.rst:232
301307
msgid "HTTPError"
@@ -313,21 +319,20 @@ msgid ""
313319
"(authentication required)."
314320
msgstr ""
315321
"从服务器返回的每个 HTTP 响应都包含一个数字的 "
316-
"“状态码”。有时该状态码表明服务器无法完成该请求。默认的处理器(函数?)将会为你处理这其中的一些响应。(例如,如果响应包含了 "
317-
"\"redirection\",将会要求客户端去向另外的 URL 获取文档,urllib "
318-
"将会为你处理该情形)。对于那些它无法处理的(状态代码),urlopen 将会引发一个 :exc:`HTTPError` "
319-
"。典型的错误包括:‘404’(页面无法找到)、‘403’(请求遭拒绝)和 ’401‘ (需要身份验证)。"
322+
"“状态码”。有时该状态码表明服务器无法完成该请求。默认的处理函数将会处理这其中的一部分响应。如若响应是“redirection”,这是要求客户端从另一 "
323+
"URL 处获取数据,urllib 将会自行处理。对于那些无法处理的状况,urlopen 将会引发 :exc:`HTTPError` "
324+
"。典型的错误包括:“404”(页面无法找到)、“403”(请求遭拒绝)和“401”(需要身份认证)。"
320325

321326
#: ../../howto/urllib2.rst:242
322327
msgid ""
323328
"See section 10 of :rfc:`2616` for a reference on all the HTTP error codes."
324-
msgstr ""
329+
msgstr "全部的 HTTP 错误码请参阅 :rfc:`2616` 。"
325330

326331
#: ../../howto/urllib2.rst:244
327332
msgid ""
328333
"The :exc:`HTTPError` instance raised will have an integer 'code' attribute, "
329334
"which corresponds to the error sent by the server."
330-
msgstr ""
335+
msgstr ":exc:`HTTPError` 实例将包含一个整数型的“code”属性,对应于服务器发来的错误。"
331336

332337
#: ../../howto/urllib2.rst:248
333338
msgid "Error Codes"
@@ -339,13 +344,16 @@ msgid ""
339344
"codes in the 100--299 range indicate success, you will usually only see "
340345
"error codes in the 400--599 range."
341346
msgstr ""
347+
"由于默认处理函数会自行处理重定向(300 以内的错误码),而且 100--299 的状态码表示成功,因此通常只会出现 400--599 的错误码。 "
342348

343349
#: ../../howto/urllib2.rst:254
344350
msgid ""
345351
":attr:`http.server.BaseHTTPRequestHandler.responses` is a useful dictionary "
346352
"of response codes in that shows all the response codes used by :rfc:`2616`. "
347353
"The dictionary is reproduced here for convenience ::"
348354
msgstr ""
355+
":attr:`http.server.BaseHTTPRequestHandler.responses` 是很有用的响应码字典,其中给出了 "
356+
":rfc:`2616` 用到的所有响应代码。为方便起见,将此字典转载如下:"
349357

350358
#: ../../howto/urllib2.rst:326
351359
msgid ""

0 commit comments

Comments
 (0)