-
-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathurllib2.po
734 lines (649 loc) · 40.4 KB
/
urllib2.po
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2001-2018, Python Software Foundation
# This file is distributed under the same license as the Python package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Python 3.7\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-06-30 05:56+0900\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Nakamura Masahito <[email protected]>, 2018\n"
"Language-Team: Japanese (https://www.transifex.com/python-doc/teams/5390/ja/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: ja\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: ../../howto/urllib2.rst:5
msgid "HOWTO Fetch Internet Resources Using The urllib Package"
msgstr "urllib パッケージを使ってインターネット上のリソースを取得するには"
#: ../../howto/urllib2.rst:0
msgid "Author"
msgstr "著者"
#: ../../howto/urllib2.rst:7
msgid "`Michael Foord <http://www.voidspace.org.uk/python/index.shtml>`_"
msgstr "`Michael Foord <http://www.voidspace.org.uk/python/index.shtml>`_"
#: ../../howto/urllib2.rst:11
msgid ""
"There is a French translation of an earlier revision of this HOWTO, "
"available at `urllib2 - Le Manuel manquant "
"<http://www.voidspace.org.uk/python/articles/urllib2_francais.shtml>`_."
msgstr ""
"この HOWTO の前段階の版のフランス語訳が `urllib2 - Le Manuel manquant "
"<http://www.voidspace.org.uk/python/articles/urllib2_francais.shtml>`_ "
"で入手できます。"
#: ../../howto/urllib2.rst:18
msgid "Introduction"
msgstr "はじめに"
#: ../../howto/urllib2.rst:22
msgid ""
"You may also find useful the following article on fetching web resources "
"with Python:"
msgstr "同じように Python でインターネットリソースを取得するのに以下の記事が役に立ちます:"
#: ../../howto/urllib2.rst:25
msgid ""
"`Basic Authentication "
"<http://www.voidspace.org.uk/python/articles/authentication.shtml>`_"
msgstr ""
"`Basic Authentication "
"<http://www.voidspace.org.uk/python/articles/authentication.shtml>`_"
#: ../../howto/urllib2.rst:27
msgid "A tutorial on *Basic Authentication*, with examples in Python."
msgstr "*Basic 認証* についてのチュートリアルで Python の例がついています。"
#: ../../howto/urllib2.rst:29
msgid ""
"**urllib.request** is a Python module for fetching URLs (Uniform Resource "
"Locators). It offers a very simple interface, in the form of the *urlopen* "
"function. This is capable of fetching URLs using a variety of different "
"protocols. It also offers a slightly more complex interface for handling "
"common situations - like basic authentication, cookies, proxies and so on. "
"These are provided by objects called handlers and openers."
msgstr ""
"**urllib.request** は URLs (Uniform Resource Locators) を取得するための Python "
"モジュールです。このモジュールはとても簡単なインターフェースを *urlopen* "
"関数の形式で提供しています。また、このモジュールは一般的な状況で利用するためにいくらか複雑なインターフェースも提供しています - basic "
"認証やクッキー、プロキシ等。これらは handler や opener と呼ばれるオブジェクトとして提供されます。"
#: ../../howto/urllib2.rst:36
msgid ""
"urllib.request supports fetching URLs for many \"URL schemes\" (identified "
"by the string before the ``\":\"`` in URL - for example ``\"ftp\"`` is the "
"URL scheme of ``\"ftp://python.org/\"``) using their associated network "
"protocols (e.g. FTP, HTTP). This tutorial focuses on the most common case, "
"HTTP."
msgstr ""
"urllib.request は多くの \"URL スキーム\" (URL の \":\" の前の文字列で識別されるもの - 例えば "
"\"ftp://python.org/\" では \"ftp\") の URL を、関連するネットワークプロトコル(例えば FTP, HTTP) "
"を利用することで、取得できます。"
#: ../../howto/urllib2.rst:41
msgid ""
"For straightforward situations *urlopen* is very easy to use. But as soon as"
" you encounter errors or non-trivial cases when opening HTTP URLs, you will "
"need some understanding of the HyperText Transfer Protocol. The most "
"comprehensive and authoritative reference to HTTP is :rfc:`2616`. This is a "
"technical document and not intended to be easy to read. This HOWTO aims to "
"illustrate using *urllib*, with enough detail about HTTP to help you "
"through. It is not intended to replace the :mod:`urllib.request` docs, but "
"is supplementary to them."
msgstr ""
"単純な状況では *urlopen* はとても簡単に使うことができます。しかし HTTP の URL "
"を開くときにエラーが起きたり、特殊なケースに遭遇すると、 HyperText Transfer Protocol "
"に関するいくつかのことを理解する必要があります。 HTTP に関して最も包括的で信頼できる文献は :rfc:`2616` "
"です。この文書は技術文書なので簡単には読めません。この HOWTO の目的は *urllib* の利用法を例示することです、 HTTP "
"についてはその助けになるのに十分に詳しく載せています。このドキュメントは :mod:`urllib.request` "
"のドキュメントの代わりにはなりませんが、補完する役割を持っています。"
#: ../../howto/urllib2.rst:51
msgid "Fetching URLs"
msgstr "URL を取得する"
#: ../../howto/urllib2.rst:53
msgid "The simplest way to use urllib.request is as follows::"
msgstr "urllib.request を利用する最も簡単な方法は以下です::"
#: ../../howto/urllib2.rst:59
msgid ""
"If you wish to retrieve a resource via URL and store it in a temporary "
"location, you can do so via the :func:`shutil.copyfileobj` and "
":func:`tempfile.NamedTemporaryFile` functions::"
msgstr ""
#: ../../howto/urllib2.rst:74
msgid ""
"Many uses of urllib will be that simple (note that instead of an 'http:' URL"
" we could have used a URL starting with 'ftp:', 'file:', etc.). However, "
"it's the purpose of this tutorial to explain the more complicated cases, "
"concentrating on HTTP."
msgstr ""
"多くの urllib の利用法はこのように簡単です ('http:' の代わりに URL を 'ftp:' や 'file:' "
"等で始めればできます)。しかし、このチュートリアルの目的は、特に HTTP に絞って、より複雑な状況を説明することです。"
#: ../../howto/urllib2.rst:79
msgid ""
"HTTP is based on requests and responses - the client makes requests and "
"servers send responses. urllib.request mirrors this with a ``Request`` "
"object which represents the HTTP request you are making. In its simplest "
"form you create a Request object that specifies the URL you want to fetch. "
"Calling ``urlopen`` with this Request object returns a response object for "
"the URL requested. This response is a file-like object, which means you can "
"for example call ``.read()`` on the response::"
msgstr ""
"HTTP はリクエスト (request) とレスポンス (response) が基本となっています - "
"クライアントがリクエストし、サーバーがレスポンスを送ります。urllib.request はこれを真似て、作成する HTTP リクエストを表現する "
"``Request`` オブジェクトを備えています。リクエストオブジェクトを作成する最も簡単な方法は取得したい URL "
"を指定することです。``urlopen`` をこのオブジェクトを使って呼び出すと、リクエストした URL "
"のレスポンスオブジェクトが返されます。このレスポンスはファイルライクオブジェクトで、これはつまりレスポンスに ``.read()`` "
"と呼び出せることを意味しています::"
#: ../../howto/urllib2.rst:93
msgid ""
"Note that urllib.request makes use of the same Request interface to handle "
"all URL schemes. For example, you can make an FTP request like so::"
msgstr ""
"urllib.request は同じリクエストインターフェースを全ての URL スキームに対して利用できるようにしています。例えば、FTP "
"リクエストの場合はこうできます::"
#: ../../howto/urllib2.rst:98
msgid ""
"In the case of HTTP, there are two extra things that Request objects allow "
"you to do: First, you can pass data to be sent to the server. Second, you "
"can pass extra information (\"metadata\") *about* the data or the about "
"request itself, to the server - this information is sent as HTTP "
"\"headers\". Let's look at each of these in turn."
msgstr ""
"HTTP の場合には、リクエストオブジェクトに対して二つの特別な操作ができます: "
"一つ目はサーバーに送るデータを渡すことができる、二つ目はサーバーに送るデータやリクエスト自身に *ついての* 特別な情報 "
"(\"metadata\")を渡すことができます - これらの送られる情報は HTTP "
"「ヘッダ」です。今度はこれらに関してひとつひとつ見ていきましょう。"
#: ../../howto/urllib2.rst:105
msgid "Data"
msgstr "データ"
#: ../../howto/urllib2.rst:107
msgid ""
"Sometimes you want to send data to a URL (often the URL will refer to a CGI "
"(Common Gateway Interface) script or other web application). With HTTP, this"
" is often done using what's known as a **POST** request. This is often what "
"your browser does when you submit a HTML form that you filled in on the web."
" Not all POSTs have to come from forms: you can use a POST to transmit "
"arbitrary data to your own application. In the common case of HTML forms, "
"the data needs to be encoded in a standard way, and then passed to the "
"Request object as the ``data`` argument. The encoding is done using a "
"function from the :mod:`urllib.parse` library. ::"
msgstr ""
"URL にデータを送りたい場合はよくあります (しばしば、その URL は CGI (Common Gateway Interface) "
"スクリプトや他の web アプリケーションを参照することになります)。これは HTTP では、 **POST** "
"リクエストとして知られる方法で行なわれます。これは web 上で HTML フォームを埋めて送信するときにブラウザが行なっていることです。全ての "
"POST がフォームから送られるとは限りません: 自身のアプリケーションに対して任意のデータを POST を使って送ることができます。一般的な HTML"
" フォームの場合、データは標準的な方法でエンコードされている必要があり、リクエストオブジェクトに ``data`` "
"引数として渡します。エンコーディングは :mod:`urllib.parse` ライブラリの関数を使って行います。 ::"
#: ../../howto/urllib2.rst:131
msgid ""
"Note that other encodings are sometimes required (e.g. for file upload from "
"HTML forms - see `HTML Specification, Form Submission <https://www.w3.org/TR"
"/REC-html40/interact/forms.html#h-17.13>`_ for more details)."
msgstr ""
"他のエンコーディングが必要な場合があることに注意して下さい (例えば、 HTML フォームからファイルをアップロードするための詳細については `HTML"
" Specification, Form Submission <https://www.w3.org/TR/REC-"
"html40/interact/forms.html#h-17.13>`_ を見て下さい)。"
#: ../../howto/urllib2.rst:136
msgid ""
"If you do not pass the ``data`` argument, urllib uses a **GET** request. One"
" way in which GET and POST requests differ is that POST requests often have "
"\"side-effects\": they change the state of the system in some way (for "
"example by placing an order with the website for a hundredweight of tinned "
"spam to be delivered to your door). Though the HTTP standard makes it clear"
" that POSTs are intended to *always* cause side-effects, and GET requests "
"*never* to cause side-effects, nothing prevents a GET request from having "
"side-effects, nor a POST requests from having no side-effects. Data can also"
" be passed in an HTTP GET request by encoding it in the URL itself."
msgstr ""
"``data`` 引数を渡さない場合、urllib は **GET** リクエストを利用します。GET と POST リクエストの一つの違いは、POST"
" リクエストにしばしば、「副作用」があることです: POST リクエストはいくつかの方法によってシステムの状態を変化させます "
"(例えば100ポンドのスパムの缶詰をドアの前まで配達する注文を web サイトで行う)。とはいえ HTTP 標準で明確にされている内容では、POST は"
" *常に* 副作用を持ち、GET リクエストは *決して* 副作用を持たないことを意図するけれども、、GET リクエストが副作用を持つことも、POST "
"リクエストが副作用を持たないことも、妨げられません。HTTP の GET "
"リクエストでもデータ自身をエンコーディングすることでデータを渡すことができます。"
#: ../../howto/urllib2.rst:146
msgid "This is done as follows::"
msgstr "以下のようにして行います::"
#: ../../howto/urllib2.rst:161
msgid ""
"Notice that the full URL is created by adding a ``?`` to the URL, followed "
"by the encoded values."
msgstr "``?`` を URL に加え、それにエンコードされた値が続くことで、完全な URL が作られていることに注意して下さい。"
#: ../../howto/urllib2.rst:165
msgid "Headers"
msgstr "ヘッダ"
#: ../../howto/urllib2.rst:167
msgid ""
"We'll discuss here one particular HTTP header, to illustrate how to add "
"headers to your HTTP request."
msgstr "ここでは特定の HTTP ヘッダについて議論します、 HTTP リクエストにヘッダを追加する方法について例示します。"
#: ../../howto/urllib2.rst:170
msgid ""
"Some websites [#]_ dislike being browsed by programs, or send different "
"versions to different browsers [#]_. By default urllib identifies itself as "
"``Python-urllib/x.y`` (where ``x`` and ``y`` are the major and minor version"
" numbers of the Python release, e.g. ``Python-urllib/2.5``), which may "
"confuse the site, or just plain not work. The way a browser identifies "
"itself is through the ``User-Agent`` header [#]_. When you create a Request "
"object you can pass a dictionary of headers in. The following example makes "
"the same request as above, but identifies itself as a version of Internet "
"Explorer [#]_. ::"
msgstr ""
"いくつかの web サイト [#]_ はプログラムからブラウズされることを嫌っていたり、異なるブラウザに対して異なるバージョンを送ります "
"[#]_。デフォルトでは urllib は自身の情報を ``Python-urllib/x.y`` として扱います ( ``x`` と ``y`` は "
"Python のリリースバージョンのメジャーバージョンとマイナーバージョンです、例えば ``Python-urllib/2.5`` など)。これによって"
" web サイト側が混乱したり、動作しないかもしれません。ブラウザは自身の情報を ``User-Agent`` ヘッダ [#]_ "
"を通して扱っています。リクエストオブジェクトを作るときに、ヘッダに辞書を渡すことができます。以下の例は上の例と同じですが、自身を Internet "
"Explorer [#]_ のバージョンの一つとして扱っています。 ::"
#: ../../howto/urllib2.rst:197
msgid ""
"The response also has two useful methods. See the section on `info and "
"geturl`_ which comes after we have a look at what happens when things go "
"wrong."
msgstr ""
"レスポンスは二つの便利なメソッドも持っています。 `info と geturl`_ "
"の節を見て下さい、この節は後で問題が起きた場合に見ておくべき内容です。"
#: ../../howto/urllib2.rst:202
msgid "Handling Exceptions"
msgstr "例外を処理する"
#: ../../howto/urllib2.rst:204
msgid ""
"*urlopen* raises :exc:`URLError` when it cannot handle a response (though as"
" usual with Python APIs, built-in exceptions such as :exc:`ValueError`, "
":exc:`TypeError` etc. may also be raised)."
msgstr ""
"*urlopen* はレスポンスを処理できなかった場合、 :exc:`URLError` を送出します (ふつうの Python API "
"では、組み込み例外の :exc:`ValueError`, :exc:`TypeError` などが送出されますが)。"
#: ../../howto/urllib2.rst:208
msgid ""
":exc:`HTTPError` is the subclass of :exc:`URLError` raised in the specific "
"case of HTTP URLs."
msgstr ":exc:`HTTPError` は :exc:`URLError` のサブクラスで HTTP URLs の特定の状況で送出されます。"
#: ../../howto/urllib2.rst:211
msgid ""
"The exception classes are exported from the :mod:`urllib.error` module."
msgstr "例外クラスは :mod:`urllib.error` モジュールから提供されています。"
#: ../../howto/urllib2.rst:214
msgid "URLError"
msgstr "URLError"
#: ../../howto/urllib2.rst:216
msgid ""
"Often, URLError is raised because there is no network connection (no route "
"to the specified server), or the specified server doesn't exist. In this "
"case, the exception raised will have a 'reason' attribute, which is a tuple "
"containing an error code and a text error message."
msgstr ""
"URLError が送出されることはよく起こります、それはネットワーク接続が無い場合や、指定したサーバが無い場合です。この場合、例外は 'reason'"
" 属性を持っていて、この属性はエラーコードとエラーメッセージのテキストを含むタプルです。"
#: ../../howto/urllib2.rst:221
msgid "e.g. ::"
msgstr "例::"
#: ../../howto/urllib2.rst:232
msgid "HTTPError"
msgstr "HTTPError"
#: ../../howto/urllib2.rst:234
msgid ""
"Every HTTP response from the server contains a numeric \"status code\". "
"Sometimes the status code indicates that the server is unable to fulfil the "
"request. The default handlers will handle some of these responses for you "
"(for example, if the response is a \"redirection\" that requests the client "
"fetch the document from a different URL, urllib will handle that for you). "
"For those it can't handle, urlopen will raise an :exc:`HTTPError`. Typical "
"errors include '404' (page not found), '403' (request forbidden), and '401' "
"(authentication required)."
msgstr ""
"サーバーからの全ての HTTP "
"レスポンスは「ステータスコード」の数値を持っています。多くの場合ステータスコードはサーバーがリクエストを実現できなかったことを意味します。デフォルトハンドラーはこれらのレスポンスのいくつかを処理してくれます(例えばレスポンスが「リダイレクション」、つまりクライアントが別の"
" URL を取得するように要求する場合には urllib はこの処理を行ってくれます。) 処理できないものに対しては urlopen は "
":exc:`HTTPError` を送出します。典型的なエラーには '404' (page not found), '403' (request "
"forbidden) と '401' (authentication required) が含まれます。"
#: ../../howto/urllib2.rst:242
msgid ""
"See section 10 of :rfc:`2616` for a reference on all the HTTP error codes."
msgstr ""
#: ../../howto/urllib2.rst:244
msgid ""
"The :exc:`HTTPError` instance raised will have an integer 'code' attribute, "
"which corresponds to the error sent by the server."
msgstr ""
"送出された :exc:`HTTPError` インスタンスは整数の 'code' 属性を持っていて、サーバーによって送られた応答に対応しています。"
#: ../../howto/urllib2.rst:248
msgid "Error Codes"
msgstr "エラーコード"
#: ../../howto/urllib2.rst:250
msgid ""
"Because the default handlers handle redirects (codes in the 300 range), and "
"codes in the 100--299 range indicate success, you will usually only see "
"error codes in the 400--599 range."
msgstr ""
"デフォルトハンドラーはリダイレクト(コードは300番台にあります) を処理し、100--"
"299番台のコードは成功を意味しているので、たいていの場合は400--599番台のエラーコードのみを見るだけですみます。"
#: ../../howto/urllib2.rst:254
msgid ""
":attr:`http.server.BaseHTTPRequestHandler.responses` is a useful dictionary "
"of response codes in that shows all the response codes used by :rfc:`2616`. "
"The dictionary is reproduced here for convenience ::"
msgstr ""
#: ../../howto/urllib2.rst:326
msgid ""
"When an error is raised the server responds by returning an HTTP error code "
"*and* an error page. You can use the :exc:`HTTPError` instance as a response"
" on the page returned. This means that as well as the code attribute, it "
"also has read, geturl, and info, methods as returned by the "
"``urllib.response`` module::"
msgstr ""
"エラーが起きた場合、サーバーは HTTP エラーコード *と* エラーページを返して応答します。返されたページに対する応答として "
":exc:`HTTPError` インスタンスを使うことができます。これは code 属性に対しても同様です、これらは "
"``urllib.response`` モジュールによって返された read も geturl, info などのメソッドも持っています::"
#: ../../howto/urllib2.rst:346
msgid "Wrapping it Up"
msgstr "エラーをラップする"
#: ../../howto/urllib2.rst:348
msgid ""
"So if you want to be prepared for :exc:`HTTPError` *or* :exc:`URLError` "
"there are two basic approaches. I prefer the second approach."
msgstr ""
":exc:`HTTPError` *または* :exc:`URLError` "
"が起きたときのために準備しておきたい場合には。二つの基本的なアプローチがあります。私は二つ目のアプローチを好みます。"
#: ../../howto/urllib2.rst:352
msgid "Number 1"
msgstr "その1"
#: ../../howto/urllib2.rst:374
msgid ""
"The ``except HTTPError`` *must* come first, otherwise ``except URLError`` "
"will *also* catch an :exc:`HTTPError`."
msgstr ""
"``except HTTPError`` が *必ず* 最初に来る必要があります、そうしないと ``except URLError`` も "
":exc:`HTTPError` を捕捉してしまいます。"
#: ../../howto/urllib2.rst:378
msgid "Number 2"
msgstr "その2"
#: ../../howto/urllib2.rst:399
msgid "info and geturl"
msgstr "info と geturl"
#: ../../howto/urllib2.rst:401
msgid ""
"The response returned by urlopen (or the :exc:`HTTPError` instance) has two "
"useful methods :meth:`info` and :meth:`geturl` and is defined in the module "
":mod:`urllib.response`.."
msgstr ""
"レスポンスは urlopen (または :exc:`HTTPError` インスタンス) によって返され、 :meth:`info` と "
":meth:`geturl` の二つの便利なメソッドを持っていて、モジュール :mod:`urllib.response` で定義されています。"
#: ../../howto/urllib2.rst:405
msgid ""
"**geturl** - this returns the real URL of the page fetched. This is useful "
"because ``urlopen`` (or the opener object used) may have followed a "
"redirect. The URL of the page fetched may not be the same as the URL "
"requested."
msgstr ""
"**geturl** - これは取得したページの実際の URL を返します。 ``urlopen`` (または利用される opener オブジェクト) "
"はリダイレクトに追従するため、有用です。取得したページの URL は要求した URL と同じとは限りません。"
#: ../../howto/urllib2.rst:409
msgid ""
"**info** - this returns a dictionary-like object that describes the page "
"fetched, particularly the headers sent by the server. It is currently an "
":class:`http.client.HTTPMessage` instance."
msgstr ""
"**info** - これは取得したページ (特にサーバからヘッダ)を表す辞書風オブジェクトを返します。これは現在では "
":class:`http.client.HTTPMessage` インスタンスです。"
#: ../../howto/urllib2.rst:413
msgid ""
"Typical headers include 'Content-length', 'Content-type', and so on. See the"
" `Quick Reference to HTTP Headers <http://jkorpela.fi/http.html>`_ for a "
"useful listing of HTTP headers with brief explanations of their meaning and "
"use."
msgstr ""
#: ../../howto/urllib2.rst:420
msgid "Openers and Handlers"
msgstr "Openers と Handlers"
#: ../../howto/urllib2.rst:422
msgid ""
"When you fetch a URL you use an opener (an instance of the perhaps "
"confusingly-named :class:`urllib.request.OpenerDirector`). Normally we have "
"been using the default opener - via ``urlopen`` - but you can create custom "
"openers. Openers use handlers. All the \"heavy lifting\" is done by the "
"handlers. Each handler knows how to open URLs for a particular URL scheme "
"(http, ftp, etc.), or how to handle an aspect of URL opening, for example "
"HTTP redirections or HTTP cookies."
msgstr ""
"URL を取得する場合、opener (混乱を招きやすい名前ですが、 :class:`urllib.request.OpenerDirector` "
"のインスタンス) を利用します。標準的にはデフォルトの opener を - ``urlopen`` を通して - 利用していますが、カスタムの "
"opener を作成することもできます。 oppener は handler を利用します。全ての「一番厄介な仕事」はハンドラによって行なわれます。各 "
"handler は特定の URL スキーム (http, ftp, 等) での URL の開き方を知っていたり、 URL "
"を開く局面でどう処理するかを知っています、例えば HTTP リダイレクションや HTTP のクッキーなど。"
#: ../../howto/urllib2.rst:430
msgid ""
"You will want to create openers if you want to fetch URLs with specific "
"handlers installed, for example to get an opener that handles cookies, or to"
" get an opener that does not handle redirections."
msgstr ""
"インストール済みの特定のハンドラで URL を取得したい場合には、 opener を作成したいと思うでしょう、例えばクッキーを処理する opener "
"が得たい場合や、リダイレクションを処理しない opener を得たい場合。"
#: ../../howto/urllib2.rst:434
msgid ""
"To create an opener, instantiate an ``OpenerDirector``, and then call "
"``.add_handler(some_handler_instance)`` repeatedly."
msgstr ""
"opener を作成するには、 ``OpenerDirector`` をインスタンス化して、続けて、 "
"``.add_handler(some_handler_instance)`` を呼び出します。"
#: ../../howto/urllib2.rst:437
msgid ""
"Alternatively, you can use ``build_opener``, which is a convenience function"
" for creating opener objects with a single function call. ``build_opener`` "
"adds several handlers by default, but provides a quick way to add more "
"and/or override the default handlers."
msgstr ""
"それに代わる方法として、 ``build_opener`` を利用することもできます、これは opener "
"オブジェクトを一回の関数呼び出しで作成できる便利な関数です。 ``build_opener`` "
"はいくつかのハンドラをデフォルトで追加しますが、デフォルトのハンドラに対して追加、継承のどちらかまたは両方を行うのに手っ取り早い方法を提供してくれます。"
#: ../../howto/urllib2.rst:442
msgid ""
"Other sorts of handlers you might want to can handle proxies, "
"authentication, and other common but slightly specialised situations."
msgstr "追加したくなる可能性がある handler としては、プロキシ処理、認証など、一般的ですがいくらか特定の状況に限られるものでしょう。"
#: ../../howto/urllib2.rst:445
msgid ""
"``install_opener`` can be used to make an ``opener`` object the (global) "
"default opener. This means that calls to ``urlopen`` will use the opener you"
" have installed."
msgstr ""
"``install_opener`` も (グローバルな) デフォルト ``opener`` オブジェクトの作成に利用できます。つまり、 "
"``urlopen`` を呼び出すと、インストールした opener が利用されます。"
#: ../../howto/urllib2.rst:449
msgid ""
"Opener objects have an ``open`` method, which can be called directly to "
"fetch urls in the same way as the ``urlopen`` function: there's no need to "
"call ``install_opener``, except as a convenience."
msgstr ""
"opener オブジェクトは ``open`` メソッドを持っていて、 ``urlopen`` 関数と同じ様に、url "
"を取得するのに直接呼び出すことができます: 利便性を除けば ``install_opener`` を使う必要はありません。"
#: ../../howto/urllib2.rst:455
msgid "Basic Authentication"
msgstr "Basic 認証"
#: ../../howto/urllib2.rst:457
msgid ""
"To illustrate creating and installing a handler we will use the "
"``HTTPBasicAuthHandler``. For a more detailed discussion of this subject -- "
"including an explanation of how Basic Authentication works - see the `Basic "
"Authentication Tutorial "
"<http://www.voidspace.org.uk/python/articles/authentication.shtml>`_."
msgstr ""
"ハンドラの作成とインストールを例示するのに、 ``HTTPBasicAuthHandler`` を利用してみます。この話題についてのより詳しい議論は "
"-- Basic 認証がどうやって動作するのかの説明も含んでいる `Basic Authentication Tutorial "
"<http://www.voidspace.org.uk/python/articles/authentication.shtml>`_ "
"を参照して下さい。"
#: ../../howto/urllib2.rst:463
msgid ""
"When authentication is required, the server sends a header (as well as the "
"401 error code) requesting authentication. This specifies the "
"authentication scheme and a 'realm'. The header looks like: ``WWW-"
"Authenticate: SCHEME realm=\"REALM\"``."
msgstr ""
"認証が必要な場合、サーバは認証を要求するヘッダ (401 のエラーコードとともに) を送ります。これによって認証スキームと 'realm' "
"が指定されます。ヘッダはこのようになっています: ``WWW-Authenticate: SCHEME realm=\"REALM\"`` 。"
#: ../../howto/urllib2.rst:468
msgid "e.g."
msgstr ""
#: ../../howto/urllib2.rst:475
msgid ""
"The client should then retry the request with the appropriate name and "
"password for the realm included as a header in the request. This is 'basic "
"authentication'. In order to simplify this process we can create an instance"
" of ``HTTPBasicAuthHandler`` and an opener to use this handler."
msgstr ""
"クライアントはリクエストヘッダに含まれる realm に対して適切な名前とパスワードとともにリクエストを再試行する必要があります。これが 'basic "
"認証' です。一連の流れを簡単化するために、 ``HTTPBasicAuthHandler`` のインスタンスを作成し、 opener が "
"handler を利用するようにします。"
#: ../../howto/urllib2.rst:480
msgid ""
"The ``HTTPBasicAuthHandler`` uses an object called a password manager to "
"handle the mapping of URLs and realms to passwords and usernames. If you "
"know what the realm is (from the authentication header sent by the server), "
"then you can use a ``HTTPPasswordMgr``. Frequently one doesn't care what the"
" realm is. In that case, it is convenient to use "
"``HTTPPasswordMgrWithDefaultRealm``. This allows you to specify a default "
"username and password for a URL. This will be supplied in the absence of you"
" providing an alternative combination for a specific realm. We indicate this"
" by providing ``None`` as the realm argument to the ``add_password`` method."
msgstr ""
"``HTTPBasicAuthHandler`` はパスワードマネージャーと呼ばれる、 URL と realm "
"をパスワードとユーザ名への対応づけを処理する、オブジェクトを利用します。 realm が何なのか(サーバから返される認証ヘッダから) 知りたい場合には、"
" ``HTTPPasswordMgr`` を利用できます。多くの場合、realm が何なのかについて気にすることはありません。そのような場合には "
"``HTTPPasswordMgrWithDefaultRealm`` を使うと便利です。これは URL "
"に対してデフォルトのユーザ名とパスワードを指定できます。これによって特定の realm "
"に対する代替の組み合わせを提供することなしに利用できるようになります。このことは ``add_password`` メソッドの realm 引数として "
"``None`` を与えることで明示することができます。"
#: ../../howto/urllib2.rst:490
msgid ""
"The top-level URL is the first URL that requires authentication. URLs "
"\"deeper\" than the URL you pass to .add_password() will also match. ::"
msgstr ""
"トップレベルの URL が認証が必要なはじめに URL です。この URL よりも「深い」URL を渡しても .add_password() "
"は同様にマッチします。::"
#: ../../howto/urllib2.rst:515
msgid ""
"In the above example we only supplied our ``HTTPBasicAuthHandler`` to "
"``build_opener``. By default openers have the handlers for normal situations"
" -- ``ProxyHandler`` (if a proxy setting such as an :envvar:`http_proxy` "
"environment variable is set), ``UnknownHandler``, ``HTTPHandler``, "
"``HTTPDefaultErrorHandler``, ``HTTPRedirectHandler``, ``FTPHandler``, "
"``FileHandler``, ``DataHandler``, ``HTTPErrorProcessor``."
msgstr ""
"上の例では ``build_opener`` に ``HTTPBasicAuthHandler`` のみを与えました。デフォルトで opener "
"は普通の状況に適用するためにいくつかのハンドラを備えています -- ``ProxyHandler`` (:envvar:`http_proxy` "
"環境変数のようなプロキシ設定がセットされている場合), ``UnknownHandler``, ``HTTPHandler``, "
"``HTTPDefaultErrorHandler``, ``HTTPRedirectHandler``, ``FTPHandler``, "
"``FileHandler``, ``DataHandler``, ``HTTPErrorProcessor`` 。"
#: ../../howto/urllib2.rst:522
msgid ""
"``top_level_url`` is in fact *either* a full URL (including the 'http:' "
"scheme component and the hostname and optionally the port number) e.g. "
"``\"http://example.com/\"`` *or* an \"authority\" (i.e. the hostname, "
"optionally including the port number) e.g. ``\"example.com\"`` or "
"``\"example.com:8080\"`` (the latter example includes a port number). The "
"authority, if present, must NOT contain the \"userinfo\" component - for "
"example ``\"joe:[email protected]\"`` is not correct."
msgstr ""
"``top_level_url`` は実際には \"http://example.com/\" のような完全な URL ('http:' "
"スキームとホスト名、オプションとしてポート番号、含む) *あるいは* \"example.com\" や \"example.com:8080\" "
"(後者はポート番号を含む) のような \"authority\" (つまり、ホスト名とオプションとしてポート番号を含む) の *どちらでも* "
"かまいません。authority の場合には \"userinfo\" 要素は含んではいけません - 例えば "
"\"joe:[email protected]\" は不適切です。"
#: ../../howto/urllib2.rst:532
msgid "Proxies"
msgstr "プロキシ"
#: ../../howto/urllib2.rst:534
msgid ""
"**urllib** will auto-detect your proxy settings and use those. This is "
"through the ``ProxyHandler``, which is part of the normal handler chain when"
" a proxy setting is detected. Normally that's a good thing, but there are "
"occasions when it may not be helpful [#]_. One way to do this is to setup "
"our own ``ProxyHandler``, with no proxies defined. This is done using "
"similar steps to setting up a `Basic Authentication`_ handler: ::"
msgstr ""
"**urllib** は自動でプロキシ設定を認識して使います。これは通常の handler の組に含まれる ``ProxyHandler`` "
"を通して行なわれます。たいていの場合はこれでうまくいきますが、役に立たない場合もあります [#]_。この問題に対処する一つの方法はプロキシを定義しない "
"``ProxyHandler`` を組み立てることです。この方法は `Basic Authentication`_ handler "
"を設定したときと同じような流れで行うことができます: ::"
#: ../../howto/urllib2.rst:547
msgid ""
"Currently ``urllib.request`` *does not* support fetching of ``https`` "
"locations through a proxy. However, this can be enabled by extending "
"urllib.request as shown in the recipe [#]_."
msgstr ""
"現在 ``urllib.request`` はプロキシ経由で ``https`` "
"ロケーションを取得する機能をサポートしていません。しかし、urllib.request をこのレシピ [#]_ "
"で拡張することで可能にすることができます。"
#: ../../howto/urllib2.rst:553
msgid ""
"``HTTP_PROXY`` will be ignored if a variable ``REQUEST_METHOD`` is set; see "
"the documentation on :func:`~urllib.request.getproxies`."
msgstr ""
"変数 ``REQUEST_METHOD`` が設定されている場合、 ``HTTP_PROXY`` は無視されます; "
":func:`~urllib.request.getproxies` のドキュメンテーションを参照してください。"
#: ../../howto/urllib2.rst:558
msgid "Sockets and Layers"
msgstr "ソケットとレイヤー"
#: ../../howto/urllib2.rst:560
msgid ""
"The Python support for fetching resources from the web is layered. urllib "
"uses the :mod:`http.client` library, which in turn uses the socket library."
msgstr ""
"Python はレイヤー化された web 上からリソース取得もサポートしています。 urllib は :mod:`http.client` "
"ライブラリを利用します、 httplib はさらに socket ライブラリを利用します。"
#: ../../howto/urllib2.rst:563
msgid ""
"As of Python 2.3 you can specify how long a socket should wait for a "
"response before timing out. This can be useful in applications which have to"
" fetch web pages. By default the socket module has *no timeout* and can "
"hang. Currently, the socket timeout is not exposed at the http.client or "
"urllib.request levels. However, you can set the default timeout globally for"
" all sockets using ::"
msgstr ""
"Python 2.3 ではレスポンスがタイムアウトするまでのソケットの待ち時間を指定することができます。これは web "
"ページを取得する場合に便利に使うことができます。socket モジュールのデフォルトでは *タイムアウトが無く* "
"ハングしてしまうかもしれません。現在では socket のタイムアウトは http.client や urllib.request "
"のレベルからは隠蔽されていています。しかし、以下を利用することで全てのソケットに対してグローバルにデフォルトタイムアウトを設定することができます ::"
#: ../../howto/urllib2.rst:586
msgid "Footnotes"
msgstr "脚注"
#: ../../howto/urllib2.rst:588
msgid "This document was reviewed and revised by John Lee."
msgstr "このドキュメントは John Lee によって査読、改訂されました。"
#: ../../howto/urllib2.rst:590
msgid "Google for example."
msgstr "Google を例題にする。"
#: ../../howto/urllib2.rst:591
msgid ""
"Browser sniffing is a very bad practice for website design - building sites "
"using web standards is much more sensible. Unfortunately a lot of sites "
"still send different versions to different browsers."
msgstr ""
"ブラウザを検知すること (browser sniffing) は web サイトのデザインにおけるとても悪い習慣です - web 標準を利用する方が賢明でしょう。\n"
"不幸なことに未だに多くの web サイトが異なるブラウザに対して異なるバージョンを返しています。"
#: ../../howto/urllib2.rst:594
msgid ""
"The user agent for MSIE 6 is *'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT"
" 5.1; SV1; .NET CLR 1.1.4322)'*"
msgstr ""
"MSIE 6 のユーザエージェントは *'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1;"
" .NET CLR 1.1.4322)'* です。"
#: ../../howto/urllib2.rst:596
msgid ""
"For details of more HTTP request headers, see `Quick Reference to HTTP "
"Headers`_."
msgstr "HTTP リクエストヘッダの詳細については、 `Quick Reference to HTTP Headers`_ を参照して下さい。"
#: ../../howto/urllib2.rst:598
msgid ""
"In my case I have to use a proxy to access the internet at work. If you "
"attempt to fetch *localhost* URLs through this proxy it blocks them. IE is "
"set to use the proxy, which urllib picks up on. In order to test scripts "
"with a localhost server, I have to prevent urllib from using the proxy."
msgstr ""
"私の場合は仕事中にインターネットにアクセスするにはプロキシを利用する必要があります。*localhost* の URL "
"に対してこのプロキシを経由してアクセスしようとすれば、ブロックされます。IE を proxy を利用するように設定すれば、urllib "
"はその情報を利用します。localhost のサーバでスクリプトをテストしようとすると、urllib がプロキシを利用するのを止めなければいけません。"
#: ../../howto/urllib2.rst:603
msgid ""
"urllib opener for SSL proxy (CONNECT method): `ASPN Cookbook Recipe "
"<https://code.activestate.com/recipes/456195/>`_."
msgstr ""
"urllib opener for SSL proxy (CONNECT method): `ASPN Cookbook Recipe "
"<https://code.activestate.com/recipes/456195/>`_."