This file is indexed.

/usr/share/doc/python-yarl-doc/html/api.html is in python-yarl-doc 1.1.0-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Public API &#8212; yarl 1.1.0- documentation</title>
    <link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    './',
        VERSION:     '1.1.0-',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true,
        SOURCELINK_SUFFIX: '.txt'
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="prev" title="yarl" href="index.html" />
   
  <link rel="stylesheet" href="_static/custom.css" type="text/css" />
  
  <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />

  </head>
  <body>
  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="module-yarl">
<span id="public-api"></span><span id="yarl-api"></span><h1>Public API<a class="headerlink" href="#module-yarl" title="Permalink to this headline"></a></h1>
<p>The only public <em>yarl</em> class is <code class="docutils literal"><span class="pre">URL</span></code>:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">yarl</span> <span class="k">import</span> <span class="n">URL</span>
</pre></div>
</div>
<dl class="class">
<dt id="yarl.URL">
<em class="property">class </em><code class="descclassname">yarl.</code><code class="descname">URL</code><span class="sig-paren">(</span><em>arg</em>, <em>*</em>, <em>encoded=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/yarl.html#URL"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#yarl.URL" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<p>Represents URL as</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>[scheme:]//[user[:password]@]host[:port][/path][?query][#fragment]
</pre></div>
</div>
<p>for absolute URLs and</p>
<div class="highlight-default"><div class="highlight"><pre><span></span>[/path][?query][#fragment]
</pre></div>
</div>
<p>for relative
ones (<a class="reference internal" href="#yarl-api-relative-urls"><span class="std std-ref">Absolute and relative URLs</span></a>).</p>
<p>Internally all data are stored as <em>percent-encoded</em> strings for
<em>user</em>, <em>path</em>, <em>query</em> and <em>fragment</em> URL parts and
<em>IDNA-encoded</em> (<span class="target" id="index-0"></span><a class="rfc reference external" href="https://tools.ietf.org/html/rfc5891.html"><strong>RFC 5891</strong></a>) for <em>host</em>.</p>
<p>Constructor and modification operators perform <em>encoding</em> for all
parts automatically.
The library assumes all data uses <em>UTF-8</em> for <em>percent-encoded</em> tokens.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path/to/?arg1=a&amp;arg2=b#fragment&#39;</span><span class="p">)</span>
<span class="go">URL(&#39;http://example.com/path/to/?arg1=a&amp;arg2=b#fragment&#39;)</span>
</pre></div>
</div>
<p>Unless URL contain the only <em>ascii</em> characters there is no differences.</p>
<p>But for <em>non-ascii</em> case <em>encoding</em> is applied.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="nb">str</span><span class="p">(</span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://εμπορικόσήμα.eu/путь/這裡&#39;</span><span class="p">))</span>
<span class="go">&#39;http://xn--jxagkqfkduily1i.eu/%D0%BF%D1%83%D1%82%D1%8C/%E9%80%99%E8%A3%A1&#39;</span>
</pre></div>
</div>
<p>The same is true for <em>user</em>, <em>password</em>, <em>query</em> and <em>fragment</em> parts of URL.</p>
<p>Already encoded URL is not changed:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://xn--jxagkqfkduily1i.eu&#39;</span><span class="p">)</span>
<span class="go">URL(&#39;http://xn--jxagkqfkduily1i.eu&#39;)</span>
</pre></div>
</div>
<p>Use <code class="xref py py-meth docutils literal"><span class="pre">URL.human_repr()</span></code> for getting human readable representation:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">url</span> <span class="o">=</span> <span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://εμπορικόσήμα.eu/путь/這裡&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">str</span><span class="p">(</span><span class="n">url</span><span class="p">)</span>
<span class="go">&#39;http://xn--jxagkqfkduily1i.eu/%D0%BF%D1%83%D1%82%D1%8C/%E9%80%99%E8%A3%A1&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">url</span><span class="o">.</span><span class="n">human_repr</span><span class="p">()</span>
<span class="go">&#39;http://εμπορικόσήμα.eu/путь/這裡&#39;</span>
</pre></div>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p>Sometimes encoding performed by <em>yarl</em> is not acceptable for
certain WEB server.</p>
<p>Passing <code class="docutils literal"><span class="pre">encoded=True</span></code> parameter prevents URL autoencoding, user is
responsible about URL correctness.</p>
<p>Don’t use this option unless there is no other way for keeping URL
attributes not touched.</p>
<p class="last">Any URL manipulations don’t guarantee correct encoding, URL parts
could be requoted even if <em>encoded</em> parameter was explicitly set.</p>
</div>
<div class="section" id="url-properties">
<h2>URL properties<a class="headerlink" href="#url-properties" title="Permalink to this headline"></a></h2>
<p>There are two kinds of properties: <em>decoded</em> and <em>encoded</em> (with
<code class="docutils literal"><span class="pre">raw_</span></code> prefix):</p>
<dl class="attribute">
<dt id="yarl.URL.scheme">
<code class="descclassname">URL.</code><code class="descname">scheme</code><a class="headerlink" href="#yarl.URL.scheme" title="Permalink to this definition"></a></dt>
<dd><p>Scheme for absolute URLs, empty string for relative URLs or URLs
starting with <cite>‘//’</cite> (<a class="reference internal" href="#yarl-api-relative-urls"><span class="std std-ref">Absolute and relative URLs</span></a>).</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">scheme</span>
<span class="go">&#39;http&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;//example.com&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">scheme</span>
<span class="go">&#39;&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;page.html&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">scheme</span>
<span class="go">&#39;&#39;</span>
</pre></div>
</div>
</dd></dl>

<dl class="attribute">
<dt id="yarl.URL.user">
<code class="descclassname">URL.</code><code class="descname">user</code><a class="reference internal" href="_modules/yarl.html#URL.user"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#yarl.URL.user" title="Permalink to this definition"></a></dt>
<dd><p>Decoded <em>user</em> part of URL, <code class="docutils literal"><span class="pre">None</span></code> if <em>user</em> is missing.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://john@example.com&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">user</span>
<span class="go">&#39;john&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://андрей@example.com&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">user</span>
<span class="go">&#39;андрей&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">user</span> <span class="ow">is</span> <span class="kc">None</span>
<span class="go">True</span>
</pre></div>
</div>
</dd></dl>

<dl class="attribute">
<dt id="yarl.URL.raw_user">
<code class="descclassname">URL.</code><code class="descname">raw_user</code><a class="headerlink" href="#yarl.URL.raw_user" title="Permalink to this definition"></a></dt>
<dd><p>Encoded <em>user</em> part of URL, <code class="docutils literal"><span class="pre">None</span></code> if <em>user</em> is missing.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://андрей@example.com&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">raw_user</span>
<span class="go">&#39;%D0%B0%D0%BD%D0%B4%D1%80%D0%B5%D0%B9&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">raw_user</span> <span class="ow">is</span> <span class="kc">None</span>
<span class="go">True</span>
</pre></div>
</div>
</dd></dl>

<dl class="attribute">
<dt id="yarl.URL.password">
<code class="descclassname">URL.</code><code class="descname">password</code><a class="reference internal" href="_modules/yarl.html#URL.password"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#yarl.URL.password" title="Permalink to this definition"></a></dt>
<dd><p>Decoded <em>password</em> part of URL, <code class="docutils literal"><span class="pre">None</span></code> if <em>user</em> is missing.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://john:pass@example.com&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">password</span>
<span class="go">&#39;pass&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://андрей:пароль@example.com&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">password</span>
<span class="go">&#39;пароль&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">password</span> <span class="ow">is</span> <span class="kc">None</span>
<span class="go">True</span>
</pre></div>
</div>
</dd></dl>

<dl class="attribute">
<dt id="yarl.URL.raw_password">
<code class="descclassname">URL.</code><code class="descname">raw_password</code><a class="headerlink" href="#yarl.URL.raw_password" title="Permalink to this definition"></a></dt>
<dd><p>Encoded <em>password</em> part of URL, <code class="docutils literal"><span class="pre">None</span></code> if <em>user</em> is missing.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://user:пароль@example.com&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">raw_password</span>
<span class="go">&#39;%D0%BF%D0%B0%D1%80%D0%BE%D0%BB%D1%8C&#39;</span>
</pre></div>
</div>
</dd></dl>

<dl class="attribute">
<dt id="yarl.URL.host">
<code class="descclassname">URL.</code><code class="descname">host</code><a class="reference internal" href="_modules/yarl.html#URL.host"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#yarl.URL.host" title="Permalink to this definition"></a></dt>
<dd><p>Encoded <em>host</em> part of URL, <code class="docutils literal"><span class="pre">None</span></code> for relative URLs
(<a class="reference internal" href="#yarl-api-relative-urls"><span class="std std-ref">Absolute and relative URLs</span></a>).</p>
<p>Brackets are stripped for IPv6. Host is converted to lowercase,
address is validated and converted to compressed form.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">host</span>
<span class="go">&#39;example.com&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://хост.домен&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">host</span>
<span class="go">&#39;хост.домен&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;page.html&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">host</span> <span class="ow">is</span> <span class="kc">None</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://[::1]&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">host</span>
<span class="go">&#39;::1&#39;</span>
</pre></div>
</div>
</dd></dl>

<dl class="attribute">
<dt id="yarl.URL.raw_host">
<code class="descclassname">URL.</code><code class="descname">raw_host</code><a class="headerlink" href="#yarl.URL.raw_host" title="Permalink to this definition"></a></dt>
<dd><p>IDNA decoded <em>host</em> part of URL, <code class="docutils literal"><span class="pre">None</span></code> for relative URLs
(<a class="reference internal" href="#yarl-api-relative-urls"><span class="std std-ref">Absolute and relative URLs</span></a>).</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://хост.домен&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">raw_host</span>
<span class="go">&#39;xn--n1agdj.xn--d1acufc&#39;</span>
</pre></div>
</div>
</dd></dl>

<dl class="attribute">
<dt id="yarl.URL.port">
<code class="descclassname">URL.</code><code class="descname">port</code><a class="headerlink" href="#yarl.URL.port" title="Permalink to this definition"></a></dt>
<dd><p><em>port</em> part of URL.</p>
<p><code class="docutils literal"><span class="pre">None</span></code> for relative URLs (<a class="reference internal" href="#yarl-api-relative-urls"><span class="std std-ref">Absolute and relative URLs</span></a>) or for
URLs without explicit port and <a class="reference internal" href="#yarl.URL.scheme" title="yarl.URL.scheme"><code class="xref py py-attr docutils literal"><span class="pre">URL.scheme</span></code></a> without
<a class="reference internal" href="#yarl-api-default-ports"><span class="std std-ref">default port substitution</span></a>.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com:8080&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">port</span>
<span class="go">8080</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">port</span>
<span class="go">80</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;page.html&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">port</span> <span class="ow">is</span> <span class="kc">None</span>
<span class="go">True</span>
</pre></div>
</div>
</dd></dl>

<dl class="attribute">
<dt id="yarl.URL.path">
<code class="descclassname">URL.</code><code class="descname">path</code><a class="reference internal" href="_modules/yarl.html#URL.path"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#yarl.URL.path" title="Permalink to this definition"></a></dt>
<dd><p>Decoded <em>path</em> part of URL, <code class="docutils literal"><span class="pre">'/'</span></code> for absolute URLs without <em>path</em> part.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path/to&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">path</span>
<span class="go">&#39;/path/to&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/путь/сюда&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">path</span>
<span class="go">&#39;/путь/сюда&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">path</span>
<span class="go">&#39;/&#39;</span>
</pre></div>
</div>
</dd></dl>

<dl class="attribute">
<dt id="yarl.URL.path_qs">
<code class="descclassname">URL.</code><code class="descname">path_qs</code><a class="reference internal" href="_modules/yarl.html#URL.path_qs"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#yarl.URL.path_qs" title="Permalink to this definition"></a></dt>
<dd><p>Decoded <em>path</em> part of URL and query string, <code class="docutils literal"><span class="pre">'/'</span></code> for absolute URLs without <em>path</em> part.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path/to?a1=a&amp;a2=b&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">path_qs</span>
<span class="go">&#39;/path/to?a1=a&amp;a2=b&#39;</span>
</pre></div>
</div>
</dd></dl>

<dl class="attribute">
<dt id="yarl.URL.raw_path_qs">
<code class="descclassname">URL.</code><code class="descname">raw_path_qs</code><a class="reference internal" href="_modules/yarl.html#URL.raw_path_qs"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#yarl.URL.raw_path_qs" title="Permalink to this definition"></a></dt>
<dd><p>Encoded <em>path</em> part of URL and query string, <code class="docutils literal"><span class="pre">'/'</span></code> for absolute URLs without <em>path</em> part.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/путь/сюда?ключ=знач&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">raw_path_qs</span>
<span class="go">&#39;/%D0%BF%D1%83%D1%82%D1%8C/%D1%81%D1%8E%D0%B4%D0%B0?%D0%BA%D0%BB%D1%8E%D1%87=%D0%B7%D0%BD%D0%B0%D1%87&#39;</span>
</pre></div>
</div>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.15.</span></p>
</div>
</dd></dl>

<dl class="attribute">
<dt id="yarl.URL.raw_path">
<code class="descclassname">URL.</code><code class="descname">raw_path</code><a class="headerlink" href="#yarl.URL.raw_path" title="Permalink to this definition"></a></dt>
<dd><p>Encoded <em>path</em> part of URL, <code class="docutils literal"><span class="pre">'/'</span></code> for absolute URLs without <em>path</em> part.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/путь/сюда&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">raw_path</span>
<span class="go">&#39;/%D0%BF%D1%83%D1%82%D1%8C/%D1%81%D1%8E%D0%B4%D0%B0&#39;</span>
</pre></div>
</div>
</dd></dl>

<dl class="attribute">
<dt id="yarl.URL.query_string">
<code class="descclassname">URL.</code><code class="descname">query_string</code><a class="reference internal" href="_modules/yarl.html#URL.query_string"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#yarl.URL.query_string" title="Permalink to this definition"></a></dt>
<dd><p>Decoded <em>query</em> part of URL, empty string if <em>query</em> is missing.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path?a1=a&amp;a2=b&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">query_string</span>
<span class="go">&#39;a1=a&amp;a2=b&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path?ключ=знач&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">query_string</span>
<span class="go">&#39;ключ=знач&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">query_string</span>
<span class="go">&#39;&#39;</span>
</pre></div>
</div>
</dd></dl>

<dl class="attribute">
<dt id="yarl.URL.raw_query_string">
<code class="descclassname">URL.</code><code class="descname">raw_query_string</code><a class="headerlink" href="#yarl.URL.raw_query_string" title="Permalink to this definition"></a></dt>
<dd><p>Encoded <em>query</em> part of URL, empty string if <em>query</em> is missing.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path?ключ=знач&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">raw_query_string</span>
<span class="go">&#39;%D0%BA%D0%BB%D1%8E%D1%87=%D0%B7%D0%BD%D0%B0%D1%87&#39;</span>
</pre></div>
</div>
</dd></dl>

<dl class="attribute">
<dt id="yarl.URL.fragment">
<code class="descclassname">URL.</code><code class="descname">fragment</code><a class="reference internal" href="_modules/yarl.html#URL.fragment"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#yarl.URL.fragment" title="Permalink to this definition"></a></dt>
<dd><p>Encoded <em>fragment</em> part of URL, empty string if <em>fragment</em> is missing.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path#fragment&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">fragment</span>
<span class="go">&#39;fragment&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path#якорь&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">fragment</span>
<span class="go">&#39;якорь&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">fragment</span>
<span class="go">&#39;&#39;</span>
</pre></div>
</div>
</dd></dl>

<dl class="attribute">
<dt id="yarl.URL.raw_fragment">
<code class="descclassname">URL.</code><code class="descname">raw_fragment</code><a class="headerlink" href="#yarl.URL.raw_fragment" title="Permalink to this definition"></a></dt>
<dd><p>Decoded <em>fragment</em> part of URL, empty string if <em>fragment</em> is missing.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path#якорь&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">raw_fragment</span>
<span class="go">&#39;%D1%8F%D0%BA%D0%BE%D1%80%D1%8C&#39;</span>
</pre></div>
</div>
</dd></dl>

<p>For <em>path</em> and <em>query</em> <em>yarl</em> supports additional helpers:</p>
<dl class="attribute">
<dt id="yarl.URL.parts">
<code class="descclassname">URL.</code><code class="descname">parts</code><a class="reference internal" href="_modules/yarl.html#URL.parts"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#yarl.URL.parts" title="Permalink to this definition"></a></dt>
<dd><p>A <code class="xref py py-class docutils literal"><span class="pre">tuple</span></code> containing decoded <em>path</em> parts, <code class="docutils literal"><span class="pre">('/',)</span></code> for
absolute URLs if <em>path</em> is missing.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path/to&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">parts</span>
<span class="go">(&#39;/&#39;, &#39;path&#39;, &#39;to&#39;)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/путь/сюда&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">parts</span>
<span class="go">(&#39;/&#39;, &#39;путь&#39;, &#39;сюда&#39;)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">parts</span>
<span class="go">(&#39;/&#39;,)</span>
</pre></div>
</div>
</dd></dl>

<dl class="attribute">
<dt id="yarl.URL.raw_parts">
<code class="descclassname">URL.</code><code class="descname">raw_parts</code><a class="reference internal" href="_modules/yarl.html#URL.raw_parts"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#yarl.URL.raw_parts" title="Permalink to this definition"></a></dt>
<dd><p>A <code class="xref py py-class docutils literal"><span class="pre">tuple</span></code> containing encoded <em>path</em> parts, <code class="docutils literal"><span class="pre">('/',)</span></code> for
absolute URLs if <em>path</em> is missing.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/путь/сюда&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">raw_parts</span>
<span class="go">(&#39;/&#39;, &#39;%D0%BF%D1%83%D1%82%D1%8C&#39;, &#39;%D1%81%D1%8E%D0%B4%D0%B0&#39;)</span>
</pre></div>
</div>
</dd></dl>

<dl class="attribute">
<dt id="yarl.URL.name">
<code class="descclassname">URL.</code><code class="descname">name</code><a class="reference internal" href="_modules/yarl.html#URL.name"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#yarl.URL.name" title="Permalink to this definition"></a></dt>
<dd><p>The last part of <a class="reference internal" href="#yarl.URL.parts" title="yarl.URL.parts"><code class="xref py py-attr docutils literal"><span class="pre">parts</span></code></a>.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path/to&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">name</span>
<span class="go">&#39;to&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/путь/сюда&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">name</span>
<span class="go">&#39;сюда&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path/&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">name</span>
<span class="go">&#39;&#39;</span>
</pre></div>
</div>
</dd></dl>

<dl class="attribute">
<dt id="yarl.URL.raw_name">
<code class="descclassname">URL.</code><code class="descname">raw_name</code><a class="reference internal" href="_modules/yarl.html#URL.raw_name"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#yarl.URL.raw_name" title="Permalink to this definition"></a></dt>
<dd><p>The last part of <a class="reference internal" href="#yarl.URL.raw_parts" title="yarl.URL.raw_parts"><code class="xref py py-attr docutils literal"><span class="pre">raw_parts</span></code></a>.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/путь/сюда&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">raw_name</span>
<span class="go">&#39;%D1%81%D1%8E%D0%B4%D0%B0&#39;</span>
</pre></div>
</div>
</dd></dl>

<dl class="attribute">
<dt id="yarl.URL.query">
<code class="descclassname">URL.</code><code class="descname">query</code><a class="reference internal" href="_modules/yarl.html#URL.query"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#yarl.URL.query" title="Permalink to this definition"></a></dt>
<dd><p>A <code class="xref py py-class docutils literal"><span class="pre">multidict.MultiDictProxy</span></code> representing parsed <em>query</em>
parameters in decoded representation.  Empty value if URL has no
<em>query</em> part.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path?a1=a&amp;a2=b&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">query</span>
<span class="go">&lt;MultiDictProxy(&#39;a1&#39;: &#39;a&#39;, &#39;a2&#39;: &#39;b&#39;)&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path?ключ=знач&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">query</span>
<span class="go">&lt;MultiDictProxy(&#39;ключ&#39;: &#39;знач&#39;)&gt;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">query</span>
<span class="go">&lt;MultiDictProxy()&gt;</span>
</pre></div>
</div>
</dd></dl>

</div>
<div class="section" id="absolute-and-relative-urls">
<span id="yarl-api-relative-urls"></span><h2>Absolute and relative URLs<a class="headerlink" href="#absolute-and-relative-urls" title="Permalink to this headline"></a></h2>
<p>The module supports both absolute and relative URLs.</p>
<p>Absolute URL should start from either <em>scheme</em> or <code class="docutils literal"><span class="pre">'//'</span></code>.</p>
<dl class="method">
<dt id="yarl.URL.is_absolute">
<code class="descclassname">URL.</code><code class="descname">is_absolute</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/yarl.html#URL.is_absolute"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#yarl.URL.is_absolute" title="Permalink to this definition"></a></dt>
<dd><blockquote>
<div><p>A check for absolute URLs.</p>
<p>Return <code class="docutils literal"><span class="pre">True</span></code> for absolute ones (having <em>scheme</em> or starting
with <code class="docutils literal"><span class="pre">//</span></code>), <code class="docutils literal"><span class="pre">False</span></code> otherwise.</p>
</div></blockquote>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">is_absolute</span><span class="p">()</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;//example.com&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">is_absolute</span><span class="p">()</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;/path/to&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">is_absolute</span><span class="p">()</span>
<span class="go">False</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;path&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">is_absolute</span><span class="p">()</span>
<span class="go">False</span>
</pre></div>
</div>
</dd></dl>

</div>
<div class="section" id="new-url-generation">
<h2>New URL generation<a class="headerlink" href="#new-url-generation" title="Permalink to this headline"></a></h2>
<p>URL is an immutable object, every operation described in the
section generates a new <em>URL</em> instance.</p>
<dl class="method">
<dt id="yarl.URL.build">
<code class="descclassname">URL.</code><code class="descname">build</code><span class="sig-paren">(</span><em>*</em>, <em>scheme</em>, <em>user</em>, <em>password</em>, <em>host</em>, <em>port</em>, <em>path</em>, <em>query</em>, <em>query_string</em>, <em>fragment</em>, <em>strict=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/yarl.html#URL.build"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#yarl.URL.build" title="Permalink to this definition"></a></dt>
<dd><p>Creates and returns a new URL:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="o">.</span><span class="n">build</span><span class="p">(</span><span class="n">scheme</span><span class="o">=</span><span class="s2">&quot;http&quot;</span><span class="p">,</span> <span class="n">host</span><span class="o">=</span><span class="s2">&quot;example.com&quot;</span><span class="p">)</span>
<span class="go">URL(&#39;http://example.com&#39;)</span>

<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="o">.</span><span class="n">build</span><span class="p">(</span><span class="n">scheme</span><span class="o">=</span><span class="s2">&quot;http&quot;</span><span class="p">,</span> <span class="n">host</span><span class="o">=</span><span class="s2">&quot;example.com&quot;</span><span class="p">,</span> <span class="n">query</span><span class="o">=</span><span class="p">{</span><span class="s2">&quot;a&quot;</span><span class="p">:</span> <span class="s2">&quot;b&quot;</span><span class="p">})</span>
<span class="go">URL(&#39;http://example.com/?a=b&#39;)</span>

<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="o">.</span><span class="n">build</span><span class="p">(</span><span class="n">scheme</span><span class="o">=</span><span class="s2">&quot;http&quot;</span><span class="p">,</span> <span class="n">host</span><span class="o">=</span><span class="s2">&quot;example.com&quot;</span><span class="p">,</span> <span class="n">query_string</span><span class="o">=</span><span class="s2">&quot;a=b&quot;</span><span class="p">)</span>
<span class="go">URL(&#39;http://example.com/?a=b&#39;)</span>

<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="o">.</span><span class="n">build</span><span class="p">()</span>
<span class="go">URL(&#39;&#39;)</span>
</pre></div>
</div>
<p>Calling <code class="docutils literal"><span class="pre">build</span></code> method without arguments is equal to calling
<code class="docutils literal"><span class="pre">__init__</span></code> without arguments.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">When <code class="docutils literal"><span class="pre">scheme</span></code> and <code class="docutils literal"><span class="pre">host</span></code> are passed new URL will be “absolute”. If only one of <code class="docutils literal"><span class="pre">scheme</span></code> or <code class="docutils literal"><span class="pre">host</span></code> is
passed then AssertionError will be raised.</p>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Only one of <code class="docutils literal"><span class="pre">query</span></code> or <code class="docutils literal"><span class="pre">query_string</span></code> should be passed then AssertionError will be raised.</p>
</div>
</dd></dl>

<dl class="method">
<dt id="yarl.URL.with_scheme">
<code class="descclassname">URL.</code><code class="descname">with_scheme</code><span class="sig-paren">(</span><em>scheme</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/yarl.html#URL.with_scheme"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#yarl.URL.with_scheme" title="Permalink to this definition"></a></dt>
<dd><p>Return a new URL with <em>scheme</em> replaced:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">with_scheme</span><span class="p">(</span><span class="s1">&#39;https&#39;</span><span class="p">)</span>
<span class="go">URL(&#39;https://example.com&#39;)</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="yarl.URL.with_user">
<code class="descclassname">URL.</code><code class="descname">with_user</code><span class="sig-paren">(</span><em>user</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/yarl.html#URL.with_user"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#yarl.URL.with_user" title="Permalink to this definition"></a></dt>
<dd><p>Return a new URL with <em>user</em> replaced, autoencode <em>user</em> if needed.</p>
<p>Clear user/password if <em>user</em> is <code class="docutils literal"><span class="pre">None</span></code>.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://user:pass@example.com&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">with_user</span><span class="p">(</span><span class="s1">&#39;new_user&#39;</span><span class="p">)</span>
<span class="go">URL(&#39;http://new_user:pass@example.com&#39;)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://user:pass@example.com&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">with_user</span><span class="p">(</span><span class="s1">&#39;вася&#39;</span><span class="p">)</span>
<span class="go">URL(&#39;http://%D0%B2%D0%B0%D1%81%D1%8F:pass@example.com&#39;)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://user:pass@example.com&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">with_user</span><span class="p">(</span><span class="kc">None</span><span class="p">)</span>
<span class="go">URL(&#39;http://example.com&#39;)</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="yarl.URL.with_password">
<code class="descclassname">URL.</code><code class="descname">with_password</code><span class="sig-paren">(</span><em>password</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/yarl.html#URL.with_password"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#yarl.URL.with_password" title="Permalink to this definition"></a></dt>
<dd><p>Return a new URL with <em>password</em> replaced, autoencode <em>password</em> if needed.</p>
<p>Clear password if <code class="docutils literal"><span class="pre">None</span></code> is passed.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://user:pass@example.com&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">with_password</span><span class="p">(</span><span class="s1">&#39;пароль&#39;</span><span class="p">)</span>
<span class="go">URL(&#39;http://user:%D0%BF%D0%B0%D1%80%D0%BE%D0%BB%D1%8C@example.com&#39;)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://user:pass@example.com&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">with_password</span><span class="p">(</span><span class="kc">None</span><span class="p">)</span>
<span class="go">URL(&#39;http://user@example.com&#39;)</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="yarl.URL.with_host">
<code class="descclassname">URL.</code><code class="descname">with_host</code><span class="sig-paren">(</span><em>host</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/yarl.html#URL.with_host"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#yarl.URL.with_host" title="Permalink to this definition"></a></dt>
<dd><p>Return a new URL with <em>host</em> replaced, autoencode <em>host</em> if needed.</p>
<p>Changing <em>host</em> for relative URLs is not allowed, use
<a class="reference internal" href="#yarl.URL.join" title="yarl.URL.join"><code class="xref py py-meth docutils literal"><span class="pre">URL.join()</span></code></a> instead.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path/to&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">with_host</span><span class="p">(</span><span class="s1">&#39;python.org&#39;</span><span class="p">)</span>
<span class="go">URL(&#39;http://python.org/path/to&#39;)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">with_host</span><span class="p">(</span><span class="s1">&#39;хост.домен&#39;</span><span class="p">)</span>
<span class="go">URL(&#39;http://xn--n1agdj.xn--d1acufc/path&#39;)</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="yarl.URL.with_port">
<code class="descclassname">URL.</code><code class="descname">with_port</code><span class="sig-paren">(</span><em>port</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/yarl.html#URL.with_port"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#yarl.URL.with_port" title="Permalink to this definition"></a></dt>
<dd><p>Return a new URL with <em>port</em> replaced.</p>
<p>Clear port to default if <code class="docutils literal"><span class="pre">None</span></code> is passed.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com:8888&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">with_port</span><span class="p">(</span><span class="mi">9999</span><span class="p">)</span>
<span class="go">URL(&#39;http://example.com:9999&#39;)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com:8888&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">with_port</span><span class="p">(</span><span class="kc">None</span><span class="p">)</span>
<span class="go">URL(&#39;http://example.com&#39;)</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="yarl.URL.with_path">
<code class="descclassname">URL.</code><code class="descname">with_path</code><span class="sig-paren">(</span><em>path</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/yarl.html#URL.with_path"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#yarl.URL.with_path" title="Permalink to this definition"></a></dt>
<dd><p>Return a new URL with <em>path</em> replaced, encode <em>path</em> if needed.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">with_path</span><span class="p">(</span><span class="s1">&#39;/path/to&#39;</span><span class="p">)</span>
<span class="go">URL(&#39;http://example.com/path/to&#39;)</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="yarl.URL.with_query">
<code class="descclassname">URL.</code><code class="descname">with_query</code><span class="sig-paren">(</span><em>query</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/yarl.html#URL.with_query"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#yarl.URL.with_query" title="Permalink to this definition"></a></dt>
<dt>
<code class="descclassname">URL.</code><code class="descname">with_query</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span></dt>
<dd><p>Return a new URL with <em>query</em> part replaced.</p>
<p>Unlike <a class="reference internal" href="#yarl.URL.update_query" title="yarl.URL.update_query"><code class="xref py py-meth docutils literal"><span class="pre">update_query()</span></code></a> the method replaces all query parameters.</p>
<p>Accepts any <code class="xref py py-class docutils literal"><span class="pre">Mapping</span></code> (e.g. <code class="xref py py-class docutils literal"><span class="pre">dict</span></code>,
<code class="xref py py-class docutils literal"><span class="pre">MultiDict</span></code> instances) or <code class="xref py py-class docutils literal"><span class="pre">str</span></code>,
autoencode the argument if needed.</p>
<p>A sequence of <code class="docutils literal"><span class="pre">(key,</span> <span class="pre">value)</span></code> pairs is supported as well.</p>
<p>Also it can take an arbitrary number of keyword arguments.</p>
<p>Clear <em>query</em> if <code class="docutils literal"><span class="pre">None</span></code> is passed.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path?a=b&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">with_query</span><span class="p">(</span><span class="s1">&#39;c=d&#39;</span><span class="p">)</span>
<span class="go">URL(&#39;http://example.com/path?c=d&#39;)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path?a=b&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">with_query</span><span class="p">({</span><span class="s1">&#39;c&#39;</span><span class="p">:</span> <span class="s1">&#39;d&#39;</span><span class="p">})</span>
<span class="go">URL(&#39;http://example.com/path?c=d&#39;)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path?a=b&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">with_query</span><span class="p">({</span><span class="s1">&#39;кл&#39;</span><span class="p">:</span> <span class="s1">&#39;зн&#39;</span><span class="p">})</span>
<span class="go">URL(&#39;http://example.com/path?%D0%BA%D0%BB=%D0%B7%D0%BD&#39;)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path?a=b&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">with_query</span><span class="p">(</span><span class="kc">None</span><span class="p">)</span>
<span class="go">URL(&#39;http://example.com/path&#39;)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path?a=b&amp;b=1&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">with_query</span><span class="p">(</span><span class="n">b</span><span class="o">=</span><span class="s1">&#39;2&#39;</span><span class="p">)</span>
<span class="go">URL(&#39;http://example.com/path?b=2&#39;)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path?a=b&amp;b=1&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">with_query</span><span class="p">([(</span><span class="s1">&#39;b&#39;</span><span class="p">,</span> <span class="s1">&#39;2&#39;</span><span class="p">)])</span>
<span class="go">URL(&#39;http://example.com/path?b=2&#39;)</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="yarl.URL.update_query">
<code class="descclassname">URL.</code><code class="descname">update_query</code><span class="sig-paren">(</span><em>query</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/yarl.html#URL.update_query"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#yarl.URL.update_query" title="Permalink to this definition"></a></dt>
<dt>
<code class="descclassname">URL.</code><code class="descname">update_query</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span></dt>
<dd><p>Returns a new URL with <em>query</em> part updated.</p>
<p>Unlike <a class="reference internal" href="#yarl.URL.with_query" title="yarl.URL.with_query"><code class="xref py py-meth docutils literal"><span class="pre">with_query()</span></code></a> the method does not replace query
completely.</p>
<p>Returned <code class="docutils literal"><span class="pre">URL</span></code> object will contain query string which updated
parts from passed query parts (or parts of parsed query string).</p>
<p>Accepts any <code class="xref py py-class docutils literal"><span class="pre">Mapping</span></code> (e.g. <code class="xref py py-class docutils literal"><span class="pre">dict</span></code>,
<code class="xref py py-class docutils literal"><span class="pre">MultiDict</span></code> instances) or <code class="xref py py-class docutils literal"><span class="pre">str</span></code>,
autoencode the argument if needed.</p>
<p>A sequence of <code class="docutils literal"><span class="pre">(key,</span> <span class="pre">value)</span></code> pairs is supported as well.</p>
<p>Also it can take an arbitrary number of keyword arguments.</p>
<p>Clear <em>query</em> if <code class="docutils literal"><span class="pre">None</span></code> is passed.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path?a=b&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">update_query</span><span class="p">(</span><span class="s1">&#39;c=d&#39;</span><span class="p">)</span>
<span class="go">URL(&#39;http://example.com/path?a=b&amp;c=d&#39;)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path?a=b&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">update_query</span><span class="p">({</span><span class="s1">&#39;c&#39;</span><span class="p">:</span> <span class="s1">&#39;d&#39;</span><span class="p">})</span>
<span class="go">URL(&#39;http://example.com/path?a=b&amp;c=d&#39;)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path?a=b&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">update_query</span><span class="p">({</span><span class="s1">&#39;кл&#39;</span><span class="p">:</span> <span class="s1">&#39;зн&#39;</span><span class="p">})</span>
<span class="go">URL(&#39;http://example.com/path?a=b&amp;%D0%BA%D0%BB=%D0%B7%D0%BD&#39;)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path?a=b&amp;b=1&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">update_query</span><span class="p">(</span><span class="n">b</span><span class="o">=</span><span class="s1">&#39;2&#39;</span><span class="p">)</span>
<span class="go">URL(&#39;http://example.com/path?a=b&amp;b=2&#39;)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path?a=b&amp;b=1&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">update_query</span><span class="p">([(</span><span class="s1">&#39;b&#39;</span><span class="p">,</span> <span class="s1">&#39;2&#39;</span><span class="p">)])</span>
<span class="go">URL(&#39;http://example.com/path?a=b&amp;b=2&#39;)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path?a=b&amp;c=e&amp;c=f&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">update_query</span><span class="p">(</span><span class="n">c</span><span class="o">=</span><span class="s1">&#39;d&#39;</span><span class="p">)</span>
<span class="go">URL(&#39;http://example.com/path?a=b&amp;c=d&#39;)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path?a=b&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">update_query</span><span class="p">(</span><span class="s1">&#39;c=d&amp;c=f&#39;</span><span class="p">)</span>
<span class="go">URL(&#39;http://example.com/path?a=b&amp;c=d&amp;c=f&#39;)</span>
</pre></div>
</div>
<div class="versionchanged">
<p><span class="versionmodified">Changed in version 1.0: </span>All multiple key/value pairs are applied to the multi-dictionary.</p>
</div>
</dd></dl>

<dl class="method">
<dt id="yarl.URL.with_fragment">
<code class="descclassname">URL.</code><code class="descname">with_fragment</code><span class="sig-paren">(</span><em>port</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/yarl.html#URL.with_fragment"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#yarl.URL.with_fragment" title="Permalink to this definition"></a></dt>
<dd><p>Return a new URL with <em>fragment</em> replaced, autoencode <em>fragment</em> if needed.</p>
<p>Clear <em>fragment</em> to default if <code class="docutils literal"><span class="pre">None</span></code> is passed.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path#frag&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">with_fragment</span><span class="p">(</span><span class="s1">&#39;anchor&#39;</span><span class="p">)</span>
<span class="go">URL(&#39;http://example.com/path#anchor&#39;)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path#frag&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">with_fragment</span><span class="p">(</span><span class="s1">&#39;якорь&#39;</span><span class="p">)</span>
<span class="go">URL(&#39;http://example.com/path#%D1%8F%D0%BA%D0%BE%D1%80%D1%8C&#39;)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path#frag&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">with_fragment</span><span class="p">(</span><span class="kc">None</span><span class="p">)</span>
<span class="go">URL(&#39;http://example.com/path&#39;)</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="yarl.URL.with_name">
<code class="descclassname">URL.</code><code class="descname">with_name</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/yarl.html#URL.with_name"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#yarl.URL.with_name" title="Permalink to this definition"></a></dt>
<dd><p>Return a new URL with <em>name</em> (last part of <em>path</em>) replaced and
cleaned up <em>query</em> and <em>fragment</em> parts.</p>
<p>Name is encoded if needed.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path/to?arg#frag&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">with_name</span><span class="p">(</span><span class="s1">&#39;new&#39;</span><span class="p">)</span>
<span class="go">URL(&#39;http://example.com/path/new&#39;)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path/to&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">with_name</span><span class="p">(</span><span class="s1">&#39;имя&#39;</span><span class="p">)</span>
<span class="go">URL(&#39;http://example.com/path/%D0%B8%D0%BC%D1%8F&#39;)</span>
</pre></div>
</div>
</dd></dl>

<dl class="attribute">
<dt id="yarl.URL.parent">
<code class="descclassname">URL.</code><code class="descname">parent</code><a class="reference internal" href="_modules/yarl.html#URL.parent"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#yarl.URL.parent" title="Permalink to this definition"></a></dt>
<dd><p>A new URL with last part of <em>path</em> removed and
cleaned up <em>query</em> and <em>fragment</em> parts.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path/to?arg#frag&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">parent</span>
<span class="go">URL(&#39;http://example.com/path&#39;)</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="yarl.URL.origin">
<code class="descclassname">URL.</code><code class="descname">origin</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/yarl.html#URL.origin"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#yarl.URL.origin" title="Permalink to this definition"></a></dt>
<dd><p>A new URL with <em>scheme</em>, <em>host</em> and <em>port</em> parts only.
<em>user</em>, <em>password</em>, <em>path</em>, <em>query</em> and <em>fragment</em> are removed.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path/to?arg#frag&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">origin</span><span class="p">()</span>
<span class="go">URL(&#39;http://example.com&#39;)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://user:pass@example.com/path&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">origin</span><span class="p">()</span>
<span class="go">URL(&#39;http://example.com&#39;)</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="yarl.URL.relative">
<code class="descclassname">URL.</code><code class="descname">relative</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/yarl.html#URL.relative"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#yarl.URL.relative" title="Permalink to this definition"></a></dt>
<dd><p>A new <em>relative</em> URL with  <em>path</em>, <em>query</em> and <em>fragment</em> parts only.
<em>scheme</em>, <em>user</em>, <em>password</em>, <em>host</em> and <em>port</em> are removed.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path/to?arg#frag&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">relative</span><span class="p">()</span>
<span class="go">URL(&#39;/path/to?arg#frag&#39;)</span>
</pre></div>
</div>
</dd></dl>

<p>Division (<code class="docutils literal"><span class="pre">/</span></code>) operator creates a new URL with appended <em>path</em> parts
and cleaned up <em>query</em> and <em>fragment</em> parts.</p>
<p>The path is encoded if needed.</p>
<blockquote>
<div><div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">url</span> <span class="o">=</span> <span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path?arg#frag&#39;</span><span class="p">)</span> <span class="o">/</span> <span class="s1">&#39;to/subpath&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">url</span>
<span class="go">URL(&#39;http://example.com/path/to/subpath&#39;)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">url</span><span class="o">.</span><span class="n">parts</span>
<span class="go">(&#39;/&#39;, &#39;path&#39;, &#39;to&#39;, &#39;subpath&#39;)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">url</span> <span class="o">=</span> <span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path?arg#frag&#39;</span><span class="p">)</span> <span class="o">/</span> <span class="s1">&#39;сюда&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">url</span>
<span class="go">URL(&#39;http://example.com/path/%D1%81%D1%8E%D0%B4%D0%B0&#39;)</span>
</pre></div>
</div>
</div></blockquote>
<dl class="method">
<dt id="yarl.URL.join">
<code class="descclassname">URL.</code><code class="descname">join</code><span class="sig-paren">(</span><em>url</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/yarl.html#URL.join"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#yarl.URL.join" title="Permalink to this definition"></a></dt>
<dd><p>Construct a full (“absolute”) URL by combining a “base URL”
(<code class="docutils literal"><span class="pre">self</span></code>) with another URL (<code class="docutils literal"><span class="pre">url</span></code>). Informally, this uses
components of the base URL, in particular the addressing scheme,
the network location and (part of) the path, to provide missing
components in the relative URL, e.g.:</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">base</span> <span class="o">=</span> <span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path/index.html&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">base</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;page.html&#39;</span><span class="p">))</span>
<span class="go">URL(&#39;http://example.com/path/page.html&#39;)</span>
</pre></div>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p>If <code class="docutils literal"><span class="pre">url</span></code> is an absolute URL (that is, starting with <code class="docutils literal"><span class="pre">//</span></code> or
<code class="docutils literal"><span class="pre">scheme://</span></code>), the url‘s host name and/or scheme will be
present in the result, e.g.:</p>
<div class="last highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">base</span> <span class="o">=</span> <span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com/path/index.html&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">base</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;//python.org/page.html&#39;</span><span class="p">))</span>
<span class="go">URL(&#39;http://python.org/page.html&#39;)</span>
</pre></div>
</div>
</div>
</dd></dl>

</div>
<div class="section" id="human-readable-representation">
<h2>Human readable representation<a class="headerlink" href="#human-readable-representation" title="Permalink to this headline"></a></h2>
<p>All URL data is stored in encoded form internally. It’s pretty good
for passing <code class="docutils literal"><span class="pre">str(url)</span></code> everywhere url string is accepted but quite
bad for memorizing by humans.</p>
<dl class="method">
<dt id="yarl.human_repr">
<code class="descclassname">yarl.</code><code class="descname">human_repr</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#yarl.human_repr" title="Permalink to this definition"></a></dt>
<dd><p>Return decoded human readable string for URL representation.</p>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">url</span> <span class="o">=</span> <span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://εμπορικόσήμα.eu/這裡&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">str</span><span class="p">(</span><span class="n">url</span><span class="p">)</span>
<span class="go">&#39;http://xn--jxagkqfkduily1i.eu/%E9%80%99%E8%A3%A1&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">url</span><span class="o">.</span><span class="n">human_repr</span><span class="p">()</span>
<span class="go">&#39;http://εμπορικόσήμα.eu/這裡&#39;</span>
</pre></div>
</div>
</dd></dl>

</div>
<div class="section" id="default-port-substitution">
<span id="yarl-api-default-ports"></span><h2>Default port substitution<a class="headerlink" href="#default-port-substitution" title="Permalink to this headline"></a></h2>
<p><a class="reference internal" href="#module-yarl" title="yarl"><code class="xref py py-mod docutils literal"><span class="pre">yarl</span></code></a> is aware about the following <em>scheme</em> -&gt; <em>port</em> translations:</p>
<table border="1" class="docutils">
<colgroup>
<col width="72%" />
<col width="28%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">scheme</th>
<th class="head">port</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><code class="docutils literal"><span class="pre">'http'</span></code></td>
<td>80</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">'https'</span></code></td>
<td>443</td>
</tr>
<tr class="row-even"><td><code class="docutils literal"><span class="pre">'ws'</span></code></td>
<td>80</td>
</tr>
<tr class="row-odd"><td><code class="docutils literal"><span class="pre">'wss'</span></code></td>
<td>443</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="yarl.URL.is_default_port">
<code class="descclassname">URL.</code><code class="descname">is_default_port</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/yarl.html#URL.is_default_port"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#yarl.URL.is_default_port" title="Permalink to this definition"></a></dt>
<dd><blockquote>
<div><p>A check for default port.</p>
<p>Return <code class="docutils literal"><span class="pre">True</span></code> if URL’s <a class="reference internal" href="#yarl.URL.port" title="yarl.URL.port"><code class="xref py py-attr docutils literal"><span class="pre">port</span></code></a> is <em>default</em> for used
<a class="reference internal" href="#yarl.URL.scheme" title="yarl.URL.scheme"><code class="xref py py-attr docutils literal"><span class="pre">scheme</span></code></a>, <code class="docutils literal"><span class="pre">False</span></code> otherwise.</p>
<p>Relative URLs have no default port.</p>
</div></blockquote>
<div class="highlight-default"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">is_default_port</span><span class="p">()</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com:80&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">is_default_port</span><span class="p">()</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;http://example.com:8080&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">is_default_port</span><span class="p">()</span>
<span class="go">False</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">URL</span><span class="p">(</span><span class="s1">&#39;/path/to&#39;</span><span class="p">)</span><span class="o">.</span><span class="n">is_default_port</span><span class="p">()</span>
<span class="go">False</span>
</pre></div>
</div>
</dd></dl>

</div>
<div class="section" id="references">
<h2>References<a class="headerlink" href="#references" title="Permalink to this headline"></a></h2>
<p><a class="reference internal" href="#module-yarl" title="yarl"><code class="xref py py-mod docutils literal"><span class="pre">yarl</span></code></a> stays on shoulders of giants: several RFC documents and
low-level <code class="xref py py-mod docutils literal"><span class="pre">urllib.parse</span></code> which performs almost all gory work.</p>
<p>The module borrowed design from <code class="xref py py-mod docutils literal"><span class="pre">pathlib</span></code> in any place where it was
possible.</p>
<div class="admonition seealso">
<p class="first admonition-title">See also</p>
<dl class="last docutils">
<dt><span class="target" id="index-1"></span><a class="rfc reference external" href="https://tools.ietf.org/html/rfc5891.html"><strong>RFC 5891</strong></a> - Internationalized Domain Names in Applications (IDNA): Protocol</dt>
<dd>Document describing non-ascii domain name encoding.</dd>
<dt><span class="target" id="index-2"></span><a class="rfc reference external" href="https://tools.ietf.org/html/rfc3987.html"><strong>RFC 3987</strong></a> - Internationalized Resource Identifiers</dt>
<dd>This specifies conversion rules for non-ascii characters in URL.</dd>
<dt><span class="target" id="index-3"></span><a class="rfc reference external" href="https://tools.ietf.org/html/rfc3986.html"><strong>RFC 3986</strong></a> - Uniform Resource Identifiers</dt>
<dd>This is the current standard (STD66). Any changes to <a class="reference internal" href="#module-yarl" title="yarl"><code class="xref py py-mod docutils literal"><span class="pre">yarl</span></code></a> module
should conform to this. Certain deviations could be observed, which are
mostly for backward compatibility purposes and for certain de-facto
parsing requirements as commonly observed in major browsers.</dd>
<dt><span class="target" id="index-4"></span><a class="rfc reference external" href="https://tools.ietf.org/html/rfc2732.html"><strong>RFC 2732</strong></a> - Format for Literal IPv6 Addresses in URL’s.</dt>
<dd>This specifies the parsing requirements of IPv6 URLs.</dd>
<dt><span class="target" id="index-5"></span><a class="rfc reference external" href="https://tools.ietf.org/html/rfc2396.html"><strong>RFC 2396</strong></a> - Uniform Resource Identifiers (URI): Generic Syntax</dt>
<dd>Document describing the generic syntactic requirements for both
Uniform Resource Names (URNs) and Uniform Resource Locators
(URLs).</dd>
<dt><span class="target" id="index-6"></span><a class="rfc reference external" href="https://tools.ietf.org/html/rfc2368.html"><strong>RFC 2368</strong></a> - The mailto URL scheme.</dt>
<dd>Parsing requirements for mailto URL schemes.</dd>
<dt><span class="target" id="index-7"></span><a class="rfc reference external" href="https://tools.ietf.org/html/rfc1808.html"><strong>RFC 1808</strong></a> - Relative Uniform Resource Locators This Request For</dt>
<dd>Comments includes the rules for joining an absolute and a
relative URL, including a fair number of “Abnormal Examples”
which govern the treatment of border cases.</dd>
<dt><span class="target" id="index-8"></span><a class="rfc reference external" href="https://tools.ietf.org/html/rfc1738.html"><strong>RFC 1738</strong></a> - Uniform Resource Locators (URL)</dt>
<dd>This specifies the formal syntax and semantics of absolute URLs.</dd>
</dl>
</div>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
<p class="logo">
  <a href="index.html">
    <img class="logo" src="_static/yarl-icon-128x128.png" alt="Logo"/>
    
  </a>
</p>



<p class="blurb">Yet another URL library</p>






<h3>Navigation</h3>
<ul class="current">
<li class="toctree-l1 current"><a class="current reference internal" href="#">Public API</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#url-properties">URL properties</a></li>
<li class="toctree-l2"><a class="reference internal" href="#absolute-and-relative-urls">Absolute and relative URLs</a></li>
<li class="toctree-l2"><a class="reference internal" href="#new-url-generation">New URL generation</a></li>
<li class="toctree-l2"><a class="reference internal" href="#human-readable-representation">Human readable representation</a></li>
<li class="toctree-l2"><a class="reference internal" href="#default-port-substitution">Default port substitution</a></li>
<li class="toctree-l2"><a class="reference internal" href="#references">References</a></li>
</ul>
</li>
</ul>


<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <div><input type="text" name="q" /></div>
      <div><input type="submit" value="Go" /></div>
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="footer">
      &copy;2016-2018, Andrew Svetlov and aio-libs team.
      
      |
      Powered by <a href="http://sphinx-doc.org/">Sphinx 1.6.6</a>
      &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.8</a>
      
      |
      <a href="_sources/api.rst.txt"
          rel="nofollow">Page source</a>
    </div>

    

    
  </body>
</html>