This file is indexed.

/usr/share/doc/python-werkzeug-doc/html/urls.html is in python-werkzeug-doc 0.10.4+dfsg1-1ubuntu1.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
<!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>URL Helpers &mdash; Werkzeug 0.10.4 documentation</title>
    
    <link rel="stylesheet" href="_static/werkzeug.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    './',
        VERSION:     '0.10.4',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </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="top" title="Werkzeug 0.10.4 documentation" href="index.html" />
    <link rel="next" title="Context Locals" href="local.html" />
    <link rel="prev" title="Utilities" href="utils.html" /> 
  </head>
  <body role="document">
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="local.html" title="Context Locals"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="utils.html" title="Utilities"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="index.html">Werkzeug 0.10.4 documentation</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="module-werkzeug.urls">
<span id="url-helpers"></span><h1>URL Helpers<a class="headerlink" href="#module-werkzeug.urls" title="Permalink to this headline"></a></h1>
<p><code class="docutils literal"><span class="pre">werkzeug.urls</span></code> used to provide several wrapper functions for Python 2
urlparse, whose main purpose were to work around the behavior of the Py2
stdlib and its lack of unicode support. While this was already a somewhat
inconvenient situation, it got even more complicated because Python 3&#8217;s
<code class="docutils literal"><span class="pre">urllib.parse</span></code> actually does handle unicode properly. In other words,
this module would wrap two libraries with completely different behavior. So
now this module contains a 2-and-3-compatible backport of Python 3&#8217;s
<code class="docutils literal"><span class="pre">urllib.parse</span></code>, which is mostly API-compatible.</p>
<dl class="class">
<dt id="werkzeug.urls.BaseURL">
<em class="property">class </em><code class="descclassname">werkzeug.urls.</code><code class="descname">BaseURL</code><a class="headerlink" href="#werkzeug.urls.BaseURL" title="Permalink to this definition"></a></dt>
<dd><p>Superclass of <a class="reference internal" href="#werkzeug.urls.URL" title="werkzeug.urls.URL"><code class="xref py py-class docutils literal"><span class="pre">URL</span></code></a> and <a class="reference internal" href="#werkzeug.urls.BytesURL" title="werkzeug.urls.BytesURL"><code class="xref py py-class docutils literal"><span class="pre">BytesURL</span></code></a>.</p>
<dl class="attribute">
<dt id="werkzeug.urls.BaseURL.ascii_host">
<code class="descname">ascii_host</code><a class="headerlink" href="#werkzeug.urls.BaseURL.ascii_host" title="Permalink to this definition"></a></dt>
<dd><p>Works exactly like <a class="reference internal" href="#werkzeug.urls.BaseURL.host" title="werkzeug.urls.BaseURL.host"><code class="xref py py-attr docutils literal"><span class="pre">host</span></code></a> but will return a result that
is restricted to ASCII.  If it finds a netloc that is not ASCII
it will attempt to idna decode it.  This is useful for socket
operations when the URL might include internationalized characters.</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.urls.BaseURL.auth">
<code class="descname">auth</code><a class="headerlink" href="#werkzeug.urls.BaseURL.auth" title="Permalink to this definition"></a></dt>
<dd><p>The authentication part in the URL if available, <cite>None</cite>
otherwise.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.urls.BaseURL.decode_netloc">
<code class="descname">decode_netloc</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.BaseURL.decode_netloc" title="Permalink to this definition"></a></dt>
<dd><p>Decodes the netloc part into a string.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.urls.BaseURL.decode_query">
<code class="descname">decode_query</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.BaseURL.decode_query" title="Permalink to this definition"></a></dt>
<dd><p>Decodes the query part of the URL.  Ths is a shortcut for
calling <a class="reference internal" href="#werkzeug.urls.url_decode" title="werkzeug.urls.url_decode"><code class="xref py py-func docutils literal"><span class="pre">url_decode()</span></code></a> on the query argument.  The arguments and
keyword arguments are forwarded to <a class="reference internal" href="#werkzeug.urls.url_decode" title="werkzeug.urls.url_decode"><code class="xref py py-func docutils literal"><span class="pre">url_decode()</span></code></a> unchanged.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.urls.BaseURL.get_file_location">
<code class="descname">get_file_location</code><span class="sig-paren">(</span><em>pathformat=None</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.BaseURL.get_file_location" title="Permalink to this definition"></a></dt>
<dd><p>Returns a tuple with the location of the file in the form
<code class="docutils literal"><span class="pre">(server,</span> <span class="pre">location)</span></code>.  If the netloc is empty in the URL or
points to localhost, it&#8217;s represented as <code class="docutils literal"><span class="pre">None</span></code>.</p>
<p>The <cite>pathformat</cite> by default is autodetection but needs to be set
when working with URLs of a specific system.  The supported values
are <code class="docutils literal"><span class="pre">'windows'</span></code> when working with Windows or DOS paths and
<code class="docutils literal"><span class="pre">'posix'</span></code> when working with posix paths.</p>
<p>If the URL does not point to to a local file, the server and location
are both represented as <code class="docutils literal"><span class="pre">None</span></code>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>pathformat</strong> &#8211; The expected format of the path component.
Currently <code class="docutils literal"><span class="pre">'windows'</span></code> and <code class="docutils literal"><span class="pre">'posix'</span></code> are
supported.  Defaults to <code class="docutils literal"><span class="pre">None</span></code> which is
autodetect.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.urls.BaseURL.host">
<code class="descname">host</code><a class="headerlink" href="#werkzeug.urls.BaseURL.host" title="Permalink to this definition"></a></dt>
<dd><p>The host part of the URL if available, otherwise <cite>None</cite>.  The
host is either the hostname or the IP address mentioned in the
URL.  It will not contain the port.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.urls.BaseURL.join">
<code class="descname">join</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.BaseURL.join" title="Permalink to this definition"></a></dt>
<dd><p>Joins this URL with another one.  This is just a convenience
function for calling into <a class="reference internal" href="#werkzeug.urls.url_join" title="werkzeug.urls.url_join"><code class="xref py py-meth docutils literal"><span class="pre">url_join()</span></code></a> and then parsing the
return value again.</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.urls.BaseURL.password">
<code class="descname">password</code><a class="headerlink" href="#werkzeug.urls.BaseURL.password" title="Permalink to this definition"></a></dt>
<dd><p>The password if it was part of the URL, <cite>None</cite> otherwise.
This undergoes URL decoding and will always be a unicode string.</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.urls.BaseURL.port">
<code class="descname">port</code><a class="headerlink" href="#werkzeug.urls.BaseURL.port" title="Permalink to this definition"></a></dt>
<dd><p>The port in the URL as an integer if it was present, <cite>None</cite>
otherwise.  This does not fill in default ports.</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.urls.BaseURL.raw_password">
<code class="descname">raw_password</code><a class="headerlink" href="#werkzeug.urls.BaseURL.raw_password" title="Permalink to this definition"></a></dt>
<dd><p>The password if it was part of the URL, <cite>None</cite> otherwise.
Unlike <a class="reference internal" href="#werkzeug.urls.BaseURL.password" title="werkzeug.urls.BaseURL.password"><code class="xref py py-attr docutils literal"><span class="pre">password</span></code></a> this one is not being decoded.</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.urls.BaseURL.raw_username">
<code class="descname">raw_username</code><a class="headerlink" href="#werkzeug.urls.BaseURL.raw_username" title="Permalink to this definition"></a></dt>
<dd><p>The username if it was part of the URL, <cite>None</cite> otherwise.
Unlike <a class="reference internal" href="#werkzeug.urls.BaseURL.username" title="werkzeug.urls.BaseURL.username"><code class="xref py py-attr docutils literal"><span class="pre">username</span></code></a> this one is not being decoded.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.urls.BaseURL.replace">
<code class="descname">replace</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.BaseURL.replace" title="Permalink to this definition"></a></dt>
<dd><p>Return an URL with the same values, except for those parameters
given new values by whichever keyword arguments are specified.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.urls.BaseURL.to_iri_tuple">
<code class="descname">to_iri_tuple</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.BaseURL.to_iri_tuple" title="Permalink to this definition"></a></dt>
<dd><p>Returns a <a class="reference internal" href="#werkzeug.urls.URL" title="werkzeug.urls.URL"><code class="xref py py-class docutils literal"><span class="pre">URL</span></code></a> tuple that holds a IRI.  This will try
to decode as much information as possible in the URL without
losing information similar to how a web browser does it for the
URL bar.</p>
<p>It&#8217;s usually more interesting to directly call <a class="reference internal" href="#werkzeug.urls.uri_to_iri" title="werkzeug.urls.uri_to_iri"><code class="xref py py-meth docutils literal"><span class="pre">uri_to_iri()</span></code></a> which
will return a string.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.urls.BaseURL.to_uri_tuple">
<code class="descname">to_uri_tuple</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.BaseURL.to_uri_tuple" title="Permalink to this definition"></a></dt>
<dd><p>Returns a <a class="reference internal" href="#werkzeug.urls.BytesURL" title="werkzeug.urls.BytesURL"><code class="xref py py-class docutils literal"><span class="pre">BytesURL</span></code></a> tuple that holds a URI.  This will
encode all the information in the URL properly to ASCII using the
rules a web browser would follow.</p>
<p>It&#8217;s usually more interesting to directly call <a class="reference internal" href="#werkzeug.urls.iri_to_uri" title="werkzeug.urls.iri_to_uri"><code class="xref py py-meth docutils literal"><span class="pre">iri_to_uri()</span></code></a> which
will return a string.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.urls.BaseURL.to_url">
<code class="descname">to_url</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.BaseURL.to_url" title="Permalink to this definition"></a></dt>
<dd><p>Returns a URL string or bytes depending on the type of the
information stored.  This is just a convenience function
for calling <a class="reference internal" href="#werkzeug.urls.url_unparse" title="werkzeug.urls.url_unparse"><code class="xref py py-meth docutils literal"><span class="pre">url_unparse()</span></code></a> for this URL.</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.urls.BaseURL.username">
<code class="descname">username</code><a class="headerlink" href="#werkzeug.urls.BaseURL.username" title="Permalink to this definition"></a></dt>
<dd><p>The username if it was part of the URL, <cite>None</cite> otherwise.
This undergoes URL decoding and will always be a unicode string.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="werkzeug.urls.BytesURL">
<em class="property">class </em><code class="descclassname">werkzeug.urls.</code><code class="descname">BytesURL</code><a class="headerlink" href="#werkzeug.urls.BytesURL" title="Permalink to this definition"></a></dt>
<dd><p>Represents a parsed URL in bytes.</p>
<dl class="method">
<dt id="werkzeug.urls.BytesURL.decode">
<code class="descname">decode</code><span class="sig-paren">(</span><em>charset='utf-8'</em>, <em>errors='replace'</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.BytesURL.decode" title="Permalink to this definition"></a></dt>
<dd><p>Decodes the URL to a tuple made out of strings.  The charset is
only being used for the path, query and fragment.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.urls.BytesURL.encode_netloc">
<code class="descname">encode_netloc</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.BytesURL.encode_netloc" title="Permalink to this definition"></a></dt>
<dd><p>Returns the netloc unchanged as bytes.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="werkzeug.urls.Href">
<em class="property">class </em><code class="descclassname">werkzeug.urls.</code><code class="descname">Href</code><span class="sig-paren">(</span><em>base='./'</em>, <em>charset='utf-8'</em>, <em>sort=False</em>, <em>key=None</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.Href" title="Permalink to this definition"></a></dt>
<dd><p>Implements a callable that constructs URLs with the given base. The
function can be called with any number of positional and keyword
arguments which than are used to assemble the URL.  Works with URLs
and posix paths.</p>
<p>Positional arguments are appended as individual segments to
the path of the URL:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">href</span> <span class="o">=</span> <span class="n">Href</span><span class="p">(</span><span class="s1">&#39;/foo&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">href</span><span class="p">(</span><span class="s1">&#39;bar&#39;</span><span class="p">,</span> <span class="mi">23</span><span class="p">)</span>
<span class="go">&#39;/foo/bar/23&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">href</span><span class="p">(</span><span class="s1">&#39;foo&#39;</span><span class="p">,</span> <span class="n">bar</span><span class="o">=</span><span class="mi">23</span><span class="p">)</span>
<span class="go">&#39;/foo/foo?bar=23&#39;</span>
</pre></div>
</div>
<p>If any of the arguments (positional or keyword) evaluates to <cite>None</cite> it
will be skipped.  If no keyword arguments are given the last argument
can be a <code class="xref py py-class docutils literal"><span class="pre">dict</span></code> or <code class="xref py py-class docutils literal"><span class="pre">MultiDict</span></code> (or any other dict subclass),
otherwise the keyword arguments are used for the query parameters, cutting
off the first trailing underscore of the parameter name:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">href</span><span class="p">(</span><span class="n">is_</span><span class="o">=</span><span class="mi">42</span><span class="p">)</span>
<span class="go">&#39;/foo?is=42&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">href</span><span class="p">({</span><span class="s1">&#39;foo&#39;</span><span class="p">:</span> <span class="s1">&#39;bar&#39;</span><span class="p">})</span>
<span class="go">&#39;/foo?foo=bar&#39;</span>
</pre></div>
</div>
<p>Combining of both methods is not allowed:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">href</span><span class="p">({</span><span class="s1">&#39;foo&#39;</span><span class="p">:</span> <span class="s1">&#39;bar&#39;</span><span class="p">},</span> <span class="n">bar</span><span class="o">=</span><span class="mi">42</span><span class="p">)</span>
<span class="gt">Traceback (most recent call last):</span>
  <span class="c">...</span>
<span class="gr">TypeError</span>: <span class="n">keyword arguments and query-dicts can&#39;t be combined</span>
</pre></div>
</div>
<p>Accessing attributes on the href object creates a new href object with
the attribute name as prefix:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">bar_href</span> <span class="o">=</span> <span class="n">href</span><span class="o">.</span><span class="n">bar</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">bar_href</span><span class="p">(</span><span class="s2">&quot;blub&quot;</span><span class="p">)</span>
<span class="go">&#39;/foo/bar/blub&#39;</span>
</pre></div>
</div>
<p>If <cite>sort</cite> is set to <cite>True</cite> the items are sorted by <cite>key</cite> or the default
sorting algorithm:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">href</span> <span class="o">=</span> <span class="n">Href</span><span class="p">(</span><span class="s2">&quot;/&quot;</span><span class="p">,</span> <span class="n">sort</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">href</span><span class="p">(</span><span class="n">a</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span> <span class="n">b</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">c</span><span class="o">=</span><span class="mi">3</span><span class="p">)</span>
<span class="go">&#39;/?a=1&amp;b=2&amp;c=3&#39;</span>
</pre></div>
</div>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.5: </span><cite>sort</cite> and <cite>key</cite> were added.</p>
</div>
</dd></dl>

<dl class="class">
<dt id="werkzeug.urls.URL">
<em class="property">class </em><code class="descclassname">werkzeug.urls.</code><code class="descname">URL</code><a class="headerlink" href="#werkzeug.urls.URL" title="Permalink to this definition"></a></dt>
<dd><p>Represents a parsed URL.  This behaves like a regular tuple but
also has some extra attributes that give further insight into the
URL.</p>
<dl class="method">
<dt id="werkzeug.urls.URL.encode">
<code class="descname">encode</code><span class="sig-paren">(</span><em>charset='utf-8'</em>, <em>errors='replace'</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.URL.encode" title="Permalink to this definition"></a></dt>
<dd><p>Encodes the URL to a tuple made out of bytes.  The charset is
only being used for the path, query and fragment.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.urls.URL.encode_netloc">
<code class="descname">encode_netloc</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.URL.encode_netloc" title="Permalink to this definition"></a></dt>
<dd><p>Encodes the netloc part to an ASCII safe URL as bytes.</p>
</dd></dl>

</dd></dl>

<dl class="function">
<dt id="werkzeug.urls.iri_to_uri">
<code class="descclassname">werkzeug.urls.</code><code class="descname">iri_to_uri</code><span class="sig-paren">(</span><em>iri</em>, <em>charset='utf-8'</em>, <em>errors='strict'</em>, <em>safe_conversion=False</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.iri_to_uri" title="Permalink to this definition"></a></dt>
<dd><p>Converts any unicode based IRI to an acceptable ASCII URI. Werkzeug always
uses utf-8 URLs internally because this is what browsers and HTTP do as
well. In some places where it accepts an URL it also accepts a unicode IRI
and converts it into a URI.</p>
<p>Examples for IRI versus URI:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">iri_to_uri</span><span class="p">(</span><span class="s1">u&#39;http://☃.net/&#39;</span><span class="p">)</span>
<span class="go">&#39;http://xn--n3h.net/&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">iri_to_uri</span><span class="p">(</span><span class="s1">u&#39;http://üser:pässword@☃.net/påth&#39;</span><span class="p">)</span>
<span class="go">&#39;http://%C3%BCser:p%C3%A4ssword@xn--n3h.net/p%C3%A5th&#39;</span>
</pre></div>
</div>
<p>There is a general problem with IRI and URI conversion with some
protocols that appear in the wild that are in violation of the URI
specification.  In places where Werkzeug goes through a forced IRI to
URI conversion it will set the <cite>safe_conversion</cite> flag which will
not perform a conversion if the end result is already ASCII.  This
can mean that the return value is not an entirely correct URI but
it will not destroy such invalid URLs in the process.</p>
<p>As an example consider the following two IRIs:</p>
<div class="highlight-python"><div class="highlight"><pre>magnet:?xt=uri:whatever
itms-services://?action=download-manifest
</pre></div>
</div>
<p>The internal representation after parsing of those URLs is the same
and there is no way to reconstruct the original one.  If safe
conversion is enabled however this function becomes a noop for both of
those strings as they both can be considered URIs.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.6.</span></p>
</div>
<div class="versionchanged">
<p><span class="versionmodified">Changed in version 0.9.6: </span>The <cite>safe_conversion</cite> parameter was added.</p>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>iri</strong> &#8211; The IRI to convert.</li>
<li><strong>charset</strong> &#8211; The charset for the URI.</li>
<li><strong>safe_conversion</strong> &#8211; indicates if a safe conversion should take place.
For more information see the explanation above.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="werkzeug.urls.uri_to_iri">
<code class="descclassname">werkzeug.urls.</code><code class="descname">uri_to_iri</code><span class="sig-paren">(</span><em>uri</em>, <em>charset='utf-8'</em>, <em>errors='replace'</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.uri_to_iri" title="Permalink to this definition"></a></dt>
<dd><p>Converts a URI in a given charset to a IRI.</p>
<p>Examples for URI versus IRI:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">uri_to_iri</span><span class="p">(</span><span class="n">b</span><span class="s1">&#39;http://xn--n3h.net/&#39;</span><span class="p">)</span>
<span class="go">u&#39;http://\u2603.net/&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">uri_to_iri</span><span class="p">(</span><span class="n">b</span><span class="s1">&#39;http://%C3%BCser:p%C3%A4ssword@xn--n3h.net/p%C3%A5th&#39;</span><span class="p">)</span>
<span class="go">u&#39;http://\xfcser:p\xe4ssword@\u2603.net/p\xe5th&#39;</span>
</pre></div>
</div>
<p>Query strings are left unchanged:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">uri_to_iri</span><span class="p">(</span><span class="s1">&#39;/?foo=24&amp;x=</span><span class="si">%26%</span><span class="s1">2f&#39;</span><span class="p">)</span>
<span class="go">u&#39;/?foo=24&amp;x=%26%2f&#39;</span>
</pre></div>
</div>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.6.</span></p>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>uri</strong> &#8211; The URI to convert.</li>
<li><strong>charset</strong> &#8211; The charset of the URI.</li>
<li><strong>errors</strong> &#8211; The error handling on decode.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="werkzeug.urls.url_decode">
<code class="descclassname">werkzeug.urls.</code><code class="descname">url_decode</code><span class="sig-paren">(</span><em>s</em>, <em>charset='utf-8'</em>, <em>decode_keys=False</em>, <em>include_empty=True</em>, <em>errors='replace'</em>, <em>separator='&amp;'</em>, <em>cls=None</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.url_decode" title="Permalink to this definition"></a></dt>
<dd><p>Parse a querystring and return it as <code class="xref py py-class docutils literal"><span class="pre">MultiDict</span></code>.  There is a
difference in key decoding on different Python versions.  On Python 3
keys will always be fully decoded whereas on Python 2, keys will
remain bytestrings if they fit into ASCII.  On 2.x keys can be forced
to be unicode by setting <cite>decode_keys</cite> to <cite>True</cite>.</p>
<p>If the charset is set to <cite>None</cite> no unicode decoding will happen and
raw bytes will be returned.</p>
<p>Per default a missing value for a key will default to an empty key.  If
you don&#8217;t want that behavior you can set <cite>include_empty</cite> to <cite>False</cite>.</p>
<p>Per default encoding errors are ignored.  If you want a different behavior
you can set <cite>errors</cite> to <code class="docutils literal"><span class="pre">'replace'</span></code> or <code class="docutils literal"><span class="pre">'strict'</span></code>.  In strict mode a
<cite>HTTPUnicodeError</cite> is raised.</p>
<div class="versionchanged">
<p><span class="versionmodified">Changed in version 0.5: </span>In previous versions &#8221;;&#8221; and &#8220;&amp;&#8221; could be used for url decoding.
This changed in 0.5 where only &#8220;&amp;&#8221; is supported.  If you want to
use &#8221;;&#8221; instead a different <cite>separator</cite> can be provided.</p>
<p>The <cite>cls</cite> parameter was added.</p>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>s</strong> &#8211; a string with the query string to decode.</li>
<li><strong>charset</strong> &#8211; the charset of the query string.  If set to <cite>None</cite>
no unicode decoding will take place.</li>
<li><strong>decode_keys</strong> &#8211; Used on Python 2.x to control whether keys should
be forced to be unicode objects.  If set to <cite>True</cite>
then keys will be unicode in all cases. Otherwise,
they remain <cite>str</cite> if they fit into ASCII.</li>
<li><strong>include_empty</strong> &#8211; Set to <cite>False</cite> if you don&#8217;t want empty values to
appear in the dict.</li>
<li><strong>errors</strong> &#8211; the decoding error behavior.</li>
<li><strong>separator</strong> &#8211; the pair separator to be used, defaults to <code class="docutils literal"><span class="pre">&amp;</span></code></li>
<li><strong>cls</strong> &#8211; an optional dict class to use.  If this is not specified
or <cite>None</cite> the default <code class="xref py py-class docutils literal"><span class="pre">MultiDict</span></code> is used.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="werkzeug.urls.url_decode_stream">
<code class="descclassname">werkzeug.urls.</code><code class="descname">url_decode_stream</code><span class="sig-paren">(</span><em>stream</em>, <em>charset='utf-8'</em>, <em>decode_keys=False</em>, <em>include_empty=True</em>, <em>errors='replace'</em>, <em>separator='&amp;'</em>, <em>cls=None</em>, <em>limit=None</em>, <em>return_iterator=False</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.url_decode_stream" title="Permalink to this definition"></a></dt>
<dd><p>Works like <a class="reference internal" href="#werkzeug.urls.url_decode" title="werkzeug.urls.url_decode"><code class="xref py py-func docutils literal"><span class="pre">url_decode()</span></code></a> but decodes a stream.  The behavior
of stream and limit follows functions like
<a class="reference internal" href="wsgi.html#werkzeug.wsgi.make_line_iter" title="werkzeug.wsgi.make_line_iter"><code class="xref py py-func docutils literal"><span class="pre">make_line_iter()</span></code></a>.  The generator of pairs is
directly fed to the <cite>cls</cite> so you can consume the data while it&#8217;s
parsed.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.8.</span></p>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>stream</strong> &#8211; a stream with the encoded querystring</li>
<li><strong>charset</strong> &#8211; the charset of the query string.  If set to <cite>None</cite>
no unicode decoding will take place.</li>
<li><strong>decode_keys</strong> &#8211; Used on Python 2.x to control whether keys should
be forced to be unicode objects.  If set to <cite>True</cite>,
keys will be unicode in all cases. Otherwise, they
remain <cite>str</cite> if they fit into ASCII.</li>
<li><strong>include_empty</strong> &#8211; Set to <cite>False</cite> if you don&#8217;t want empty values to
appear in the dict.</li>
<li><strong>errors</strong> &#8211; the decoding error behavior.</li>
<li><strong>separator</strong> &#8211; the pair separator to be used, defaults to <code class="docutils literal"><span class="pre">&amp;</span></code></li>
<li><strong>cls</strong> &#8211; an optional dict class to use.  If this is not specified
or <cite>None</cite> the default <code class="xref py py-class docutils literal"><span class="pre">MultiDict</span></code> is used.</li>
<li><strong>limit</strong> &#8211; the content length of the URL data.  Not necessary if
a limited stream is provided.</li>
<li><strong>return_iterator</strong> &#8211; if set to <cite>True</cite> the <cite>cls</cite> argument is ignored
and an iterator over all decoded pairs is
returned</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="werkzeug.urls.url_encode">
<code class="descclassname">werkzeug.urls.</code><code class="descname">url_encode</code><span class="sig-paren">(</span><em>obj</em>, <em>charset='utf-8'</em>, <em>encode_keys=False</em>, <em>sort=False</em>, <em>key=None</em>, <em>separator='&amp;'</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.url_encode" title="Permalink to this definition"></a></dt>
<dd><p>URL encode a dict/<cite>MultiDict</cite>.  If a value is <cite>None</cite> it will not appear
in the result string.  Per default only values are encoded into the target
charset strings.  If <cite>encode_keys</cite> is set to <code class="docutils literal"><span class="pre">True</span></code> unicode keys are
supported too.</p>
<p>If <cite>sort</cite> is set to <cite>True</cite> the items are sorted by <cite>key</cite> or the default
sorting algorithm.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.5: </span><cite>sort</cite>, <cite>key</cite>, and <cite>separator</cite> were added.</p>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>obj</strong> &#8211; the object to encode into a query string.</li>
<li><strong>charset</strong> &#8211; the charset of the query string.</li>
<li><strong>encode_keys</strong> &#8211; set to <cite>True</cite> if you have unicode keys. (Ignored on
Python 3.x)</li>
<li><strong>sort</strong> &#8211; set to <cite>True</cite> if you want parameters to be sorted by <cite>key</cite>.</li>
<li><strong>separator</strong> &#8211; the separator to be used for the pairs.</li>
<li><strong>key</strong> &#8211; an optional function to be used for sorting.  For more details
check out the <code class="xref py py-func docutils literal"><span class="pre">sorted()</span></code> documentation.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="werkzeug.urls.url_encode_stream">
<code class="descclassname">werkzeug.urls.</code><code class="descname">url_encode_stream</code><span class="sig-paren">(</span><em>obj</em>, <em>stream=None</em>, <em>charset='utf-8'</em>, <em>encode_keys=False</em>, <em>sort=False</em>, <em>key=None</em>, <em>separator='&amp;'</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.url_encode_stream" title="Permalink to this definition"></a></dt>
<dd><p>Like <a class="reference internal" href="#werkzeug.urls.url_encode" title="werkzeug.urls.url_encode"><code class="xref py py-meth docutils literal"><span class="pre">url_encode()</span></code></a> but writes the results to a stream
object.  If the stream is <cite>None</cite> a generator over all encoded
pairs is returned.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.8.</span></p>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>obj</strong> &#8211; the object to encode into a query string.</li>
<li><strong>stream</strong> &#8211; a stream to write the encoded object into or <cite>None</cite> if
an iterator over the encoded pairs should be returned.  In
that case the separator argument is ignored.</li>
<li><strong>charset</strong> &#8211; the charset of the query string.</li>
<li><strong>encode_keys</strong> &#8211; set to <cite>True</cite> if you have unicode keys. (Ignored on
Python 3.x)</li>
<li><strong>sort</strong> &#8211; set to <cite>True</cite> if you want parameters to be sorted by <cite>key</cite>.</li>
<li><strong>separator</strong> &#8211; the separator to be used for the pairs.</li>
<li><strong>key</strong> &#8211; an optional function to be used for sorting.  For more details
check out the <code class="xref py py-func docutils literal"><span class="pre">sorted()</span></code> documentation.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="werkzeug.urls.url_fix">
<code class="descclassname">werkzeug.urls.</code><code class="descname">url_fix</code><span class="sig-paren">(</span><em>s</em>, <em>charset='utf-8'</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.url_fix" title="Permalink to this definition"></a></dt>
<dd><p>Sometimes you get an URL by a user that just isn&#8217;t a real URL because
it contains unsafe characters like &#8216; &#8216; and so on. This function can fix
some of the problems in a similar way browsers handle data entered by the
user:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">url_fix</span><span class="p">(</span><span class="s1">u&#39;http://de.wikipedia.org/wiki/Elf (Begriffskl</span><span class="se">\xe4</span><span class="s1">rung)&#39;</span><span class="p">)</span>
<span class="go">&#39;http://de.wikipedia.org/wiki/Elf%20(Begriffskl%C3%A4rung)&#39;</span>
</pre></div>
</div>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>s</strong> &#8211; the string with the URL to fix.</li>
<li><strong>charset</strong> &#8211; The target charset for the URL if the url was given as
unicode string.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="werkzeug.urls.url_join">
<code class="descclassname">werkzeug.urls.</code><code class="descname">url_join</code><span class="sig-paren">(</span><em>base</em>, <em>url</em>, <em>allow_fragments=True</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.url_join" title="Permalink to this definition"></a></dt>
<dd><p>Join a base URL and a possibly relative URL to form an absolute
interpretation of the latter.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>base</strong> &#8211; the base URL for the join operation.</li>
<li><strong>url</strong> &#8211; the URL to join.</li>
<li><strong>allow_fragments</strong> &#8211; indicates whether fragments should be allowed.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="werkzeug.urls.url_parse">
<code class="descclassname">werkzeug.urls.</code><code class="descname">url_parse</code><span class="sig-paren">(</span><em>url</em>, <em>scheme=None</em>, <em>allow_fragments=True</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.url_parse" title="Permalink to this definition"></a></dt>
<dd><p>Parses a URL from a string into a <a class="reference internal" href="#werkzeug.urls.URL" title="werkzeug.urls.URL"><code class="xref py py-class docutils literal"><span class="pre">URL</span></code></a> tuple.  If the URL
is lacking a scheme it can be provided as second argument. Otherwise,
it is ignored.  Optionally fragments can be stripped from the URL
by setting <cite>allow_fragments</cite> to <cite>False</cite>.</p>
<p>The inverse of this function is <a class="reference internal" href="#werkzeug.urls.url_unparse" title="werkzeug.urls.url_unparse"><code class="xref py py-func docutils literal"><span class="pre">url_unparse()</span></code></a>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>url</strong> &#8211; the URL to parse.</li>
<li><strong>scheme</strong> &#8211; the default schema to use if the URL is schemaless.</li>
<li><strong>allow_fragments</strong> &#8211; if set to <cite>False</cite> a fragment will be removed
from the URL.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="werkzeug.urls.url_quote">
<code class="descclassname">werkzeug.urls.</code><code class="descname">url_quote</code><span class="sig-paren">(</span><em>string</em>, <em>charset='utf-8'</em>, <em>errors='strict'</em>, <em>safe='/:'</em>, <em>unsafe=''</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.url_quote" title="Permalink to this definition"></a></dt>
<dd><p>URL encode a single string with a given encoding.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>s</strong> &#8211; the string to quote.</li>
<li><strong>charset</strong> &#8211; the charset to be used.</li>
<li><strong>safe</strong> &#8211; an optional sequence of safe characters.</li>
<li><strong>unsafe</strong> &#8211; an optional sequence of unsafe characters.</li>
</ul>
</td>
</tr>
</tbody>
</table>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.9.2: </span>The <cite>unsafe</cite> parameter was added.</p>
</div>
</dd></dl>

<dl class="function">
<dt id="werkzeug.urls.url_quote_plus">
<code class="descclassname">werkzeug.urls.</code><code class="descname">url_quote_plus</code><span class="sig-paren">(</span><em>string</em>, <em>charset='utf-8'</em>, <em>errors='strict'</em>, <em>safe=''</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.url_quote_plus" title="Permalink to this definition"></a></dt>
<dd><p>URL encode a single string with the given encoding and convert
whitespace to &#8220;+&#8221;.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>s</strong> &#8211; The string to quote.</li>
<li><strong>charset</strong> &#8211; The charset to be used.</li>
<li><strong>safe</strong> &#8211; An optional sequence of safe characters.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="werkzeug.urls.url_unparse">
<code class="descclassname">werkzeug.urls.</code><code class="descname">url_unparse</code><span class="sig-paren">(</span><em>components</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.url_unparse" title="Permalink to this definition"></a></dt>
<dd><p>The reverse operation to <a class="reference internal" href="#werkzeug.urls.url_parse" title="werkzeug.urls.url_parse"><code class="xref py py-meth docutils literal"><span class="pre">url_parse()</span></code></a>.  This accepts arbitrary
as well as <a class="reference internal" href="#werkzeug.urls.URL" title="werkzeug.urls.URL"><code class="xref py py-class docutils literal"><span class="pre">URL</span></code></a> tuples and returns a URL as a string.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>components</strong> &#8211; the parsed URL as tuple which should be converted
into a URL string.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="werkzeug.urls.url_unquote">
<code class="descclassname">werkzeug.urls.</code><code class="descname">url_unquote</code><span class="sig-paren">(</span><em>string</em>, <em>charset='utf-8'</em>, <em>errors='replace'</em>, <em>unsafe=''</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.url_unquote" title="Permalink to this definition"></a></dt>
<dd><p>URL decode a single string with a given encoding.  If the charset
is set to <cite>None</cite> no unicode decoding is performed and raw bytes
are returned.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>s</strong> &#8211; the string to unquote.</li>
<li><strong>charset</strong> &#8211; the charset of the query string.  If set to <cite>None</cite>
no unicode decoding will take place.</li>
<li><strong>errors</strong> &#8211; the error handling for the charset decoding.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="werkzeug.urls.url_unquote_plus">
<code class="descclassname">werkzeug.urls.</code><code class="descname">url_unquote_plus</code><span class="sig-paren">(</span><em>s</em>, <em>charset='utf-8'</em>, <em>errors='replace'</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.urls.url_unquote_plus" title="Permalink to this definition"></a></dt>
<dd><p>URL decode a single string with the given <cite>charset</cite> and decode &#8220;+&#8221; to
whitespace.</p>
<p>Per default encoding errors are ignored.  If you want a different behavior
you can set <cite>errors</cite> to <code class="docutils literal"><span class="pre">'replace'</span></code> or <code class="docutils literal"><span class="pre">'strict'</span></code>.  In strict mode a
<code class="xref py py-exc docutils literal"><span class="pre">HTTPUnicodeError</span></code> is raised.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>s</strong> &#8211; The string to unquote.</li>
<li><strong>charset</strong> &#8211; the charset of the query string.  If set to <cite>None</cite>
no unicode decoding will take place.</li>
<li><strong>errors</strong> &#8211; The error handling for the <cite>charset</cite> decoding.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</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/werkzeug.png" alt="Logo"/>
</a></p><h3>Related Topics</h3>
<ul>
  <li><a href="index.html">Documentation overview</a><ul>
      <li>Previous: <a href="utils.html" title="previous chapter">Utilities</a></li>
      <li>Next: <a href="local.html" title="next chapter">Context Locals</a></li>
  </ul></li>
</ul>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="_sources/urls.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="footer">
      &copy; Copyright 2011, The Werkzeug Team.
      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a>.
    </div>
  </body>
</html>