This file is indexed.

/usr/share/doc/python-werkzeug-doc/html/datastructures.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
 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
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
<!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>Data Structures &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="Utilities" href="utils.html" />
    <link rel="prev" title="HTTP Utilities" href="http.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="utils.html" title="Utilities"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="http.html" title="HTTP 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.datastructures">
<span id="data-structures"></span><h1>Data Structures<a class="headerlink" href="#module-werkzeug.datastructures" title="Permalink to this headline"></a></h1>
<p>Werkzeug provides some subclasses of common Python objects to extend them
with additional features.  Some of them are used to make them immutable, others
are used to change some semantics to better work with HTTP.</p>
<div class="section" id="general-purpose">
<h2>General Purpose<a class="headerlink" href="#general-purpose" title="Permalink to this headline"></a></h2>
<div class="versionchanged">
<p><span class="versionmodified">Changed in version 0.6: </span>The general purpose classes are now pickleable in each protocol as long
as the contained objects are pickleable.  This means that the
<a class="reference internal" href="#werkzeug.datastructures.FileMultiDict" title="werkzeug.datastructures.FileMultiDict"><code class="xref py py-class docutils literal"><span class="pre">FileMultiDict</span></code></a> won&#8217;t be pickleable as soon as it contains a
file.</p>
</div>
<dl class="class">
<dt id="werkzeug.datastructures.TypeConversionDict">
<em class="property">class </em><code class="descclassname">werkzeug.datastructures.</code><code class="descname">TypeConversionDict</code><a class="headerlink" href="#werkzeug.datastructures.TypeConversionDict" title="Permalink to this definition"></a></dt>
<dd><p>Works like a regular dict but the <a class="reference internal" href="#werkzeug.datastructures.TypeConversionDict.get" title="werkzeug.datastructures.TypeConversionDict.get"><code class="xref py py-meth docutils literal"><span class="pre">get()</span></code></a> method can perform
type conversions.  <a class="reference internal" href="#werkzeug.datastructures.MultiDict" title="werkzeug.datastructures.MultiDict"><code class="xref py py-class docutils literal"><span class="pre">MultiDict</span></code></a> and <a class="reference internal" href="#werkzeug.datastructures.CombinedMultiDict" title="werkzeug.datastructures.CombinedMultiDict"><code class="xref py py-class docutils literal"><span class="pre">CombinedMultiDict</span></code></a>
are subclasses of this class and provide the same feature.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.5.</span></p>
</div>
<dl class="method">
<dt id="werkzeug.datastructures.TypeConversionDict.get">
<code class="descname">get</code><span class="sig-paren">(</span><em>key</em>, <em>default=None</em>, <em>type=None</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.TypeConversionDict.get" title="Permalink to this definition"></a></dt>
<dd><p>Return the default value if the requested data doesn&#8217;t exist.
If <cite>type</cite> is provided and is a callable it should convert the value,
return it or raise a <code class="xref py py-exc docutils literal"><span class="pre">ValueError</span></code> if that is not possible.  In
this case the function will return the default as if the value was not
found:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">d</span> <span class="o">=</span> <span class="n">TypeConversionDict</span><span class="p">(</span><span class="n">foo</span><span class="o">=</span><span class="s1">&#39;42&#39;</span><span class="p">,</span> <span class="n">bar</span><span class="o">=</span><span class="s1">&#39;blub&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">d</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;foo&#39;</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="nb">int</span><span class="p">)</span>
<span class="go">42</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">d</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;bar&#39;</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="nb">int</span><span class="p">)</span>
<span class="go">-1</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>key</strong> &#8211; The key to be looked up.</li>
<li><strong>default</strong> &#8211; The default value to be returned if the key can&#8217;t
be looked up.  If not further specified <cite>None</cite> is
returned.</li>
<li><strong>type</strong> &#8211; A callable that is used to cast the value in the
<a class="reference internal" href="#werkzeug.datastructures.MultiDict" title="werkzeug.datastructures.MultiDict"><code class="xref py py-class docutils literal"><span class="pre">MultiDict</span></code></a>.  If a <code class="xref py py-exc docutils literal"><span class="pre">ValueError</span></code> is raised
by this callable the default value is returned.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="werkzeug.datastructures.ImmutableTypeConversionDict">
<em class="property">class </em><code class="descclassname">werkzeug.datastructures.</code><code class="descname">ImmutableTypeConversionDict</code><a class="headerlink" href="#werkzeug.datastructures.ImmutableTypeConversionDict" title="Permalink to this definition"></a></dt>
<dd><p>Works like a <a class="reference internal" href="#werkzeug.datastructures.TypeConversionDict" title="werkzeug.datastructures.TypeConversionDict"><code class="xref py py-class docutils literal"><span class="pre">TypeConversionDict</span></code></a> but does not support
modifications.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.5.</span></p>
</div>
<dl class="method">
<dt id="werkzeug.datastructures.ImmutableTypeConversionDict.copy">
<code class="descname">copy</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.ImmutableTypeConversionDict.copy" title="Permalink to this definition"></a></dt>
<dd><p>Return a shallow mutable copy of this object.  Keep in mind that
the standard library&#8217;s <a class="reference internal" href="#werkzeug.datastructures.ImmutableTypeConversionDict.copy" title="werkzeug.datastructures.ImmutableTypeConversionDict.copy"><code class="xref py py-func docutils literal"><span class="pre">copy()</span></code></a> function is a no-op for this class
like for any other python immutable type (eg: <code class="xref py py-class docutils literal"><span class="pre">tuple</span></code>).</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="werkzeug.datastructures.MultiDict">
<em class="property">class </em><code class="descclassname">werkzeug.datastructures.</code><code class="descname">MultiDict</code><span class="sig-paren">(</span><em>mapping=None</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.MultiDict" title="Permalink to this definition"></a></dt>
<dd><p>A <a class="reference internal" href="#werkzeug.datastructures.MultiDict" title="werkzeug.datastructures.MultiDict"><code class="xref py py-class docutils literal"><span class="pre">MultiDict</span></code></a> is a dictionary subclass customized to deal with
multiple values for the same key which is for example used by the parsing
functions in the wrappers.  This is necessary because some HTML form
elements pass multiple values for the same key.</p>
<p><a class="reference internal" href="#werkzeug.datastructures.MultiDict" title="werkzeug.datastructures.MultiDict"><code class="xref py py-class docutils literal"><span class="pre">MultiDict</span></code></a> implements all standard dictionary methods.
Internally, it saves all values for a key as a list, but the standard dict
access methods will only return the first value for a key. If you want to
gain access to the other values, too, you have to use the <cite>list</cite> methods as
explained below.</p>
<p>Basic Usage:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">d</span> <span class="o">=</span> <span class="n">MultiDict</span><span class="p">([(</span><span class="s1">&#39;a&#39;</span><span class="p">,</span> <span class="s1">&#39;b&#39;</span><span class="p">),</span> <span class="p">(</span><span class="s1">&#39;a&#39;</span><span class="p">,</span> <span class="s1">&#39;c&#39;</span><span class="p">)])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">d</span>
<span class="go">MultiDict([(&#39;a&#39;, &#39;b&#39;), (&#39;a&#39;, &#39;c&#39;)])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">d</span><span class="p">[</span><span class="s1">&#39;a&#39;</span><span class="p">]</span>
<span class="go">&#39;b&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">d</span><span class="o">.</span><span class="n">getlist</span><span class="p">(</span><span class="s1">&#39;a&#39;</span><span class="p">)</span>
<span class="go">[&#39;b&#39;, &#39;c&#39;]</span>
<span class="gp">&gt;&gt;&gt; </span><span class="s1">&#39;a&#39;</span> <span class="ow">in</span> <span class="n">d</span>
<span class="go">True</span>
</pre></div>
</div>
<p>It behaves like a normal dict thus all dict functions will only return the
first value when multiple values for one key are found.</p>
<p>From Werkzeug 0.3 onwards, the <cite>KeyError</cite> raised by this class is also a
subclass of the <code class="xref py py-exc docutils literal"><span class="pre">BadRequest</span></code> HTTP exception and will
render a page for a <code class="docutils literal"><span class="pre">400</span> <span class="pre">BAD</span> <span class="pre">REQUEST</span></code> if caught in a catch-all for HTTP
exceptions.</p>
<p>A <a class="reference internal" href="#werkzeug.datastructures.MultiDict" title="werkzeug.datastructures.MultiDict"><code class="xref py py-class docutils literal"><span class="pre">MultiDict</span></code></a> can be constructed from an iterable of
<code class="docutils literal"><span class="pre">(key,</span> <span class="pre">value)</span></code> tuples, a dict, a <a class="reference internal" href="#werkzeug.datastructures.MultiDict" title="werkzeug.datastructures.MultiDict"><code class="xref py py-class docutils literal"><span class="pre">MultiDict</span></code></a> or from Werkzeug 0.2
onwards some keyword parameters.</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>mapping</strong> &#8211; the initial value for the <a class="reference internal" href="#werkzeug.datastructures.MultiDict" title="werkzeug.datastructures.MultiDict"><code class="xref py py-class docutils literal"><span class="pre">MultiDict</span></code></a>.  Either a
regular dict, an iterable of <code class="docutils literal"><span class="pre">(key,</span> <span class="pre">value)</span></code> tuples
or <cite>None</cite>.</td>
</tr>
</tbody>
</table>
<dl class="method">
<dt id="werkzeug.datastructures.MultiDict.add">
<code class="descname">add</code><span class="sig-paren">(</span><em>key</em>, <em>value</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.MultiDict.add" title="Permalink to this definition"></a></dt>
<dd><p>Adds a new value for the key.</p>
<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>key</strong> &#8211; the key for the value.</li>
<li><strong>value</strong> &#8211; the value to add.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.MultiDict.clear">
<code class="descname">clear</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &rarr; None.  Remove all items from D.<a class="headerlink" href="#werkzeug.datastructures.MultiDict.clear" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.MultiDict.copy">
<code class="descname">copy</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.MultiDict.copy" title="Permalink to this definition"></a></dt>
<dd><p>Return a shallow copy of this object.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.MultiDict.deepcopy">
<code class="descname">deepcopy</code><span class="sig-paren">(</span><em>memo=None</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.MultiDict.deepcopy" title="Permalink to this definition"></a></dt>
<dd><p>Return a deep copy of this object.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.MultiDict.fromkeys">
<code class="descname">fromkeys</code><span class="sig-paren">(</span><em>S</em><span class="optional">[</span>, <em>v</em><span class="optional">]</span><span class="sig-paren">)</span> &rarr; New dict with keys from S and values equal to v.<a class="headerlink" href="#werkzeug.datastructures.MultiDict.fromkeys" title="Permalink to this definition"></a></dt>
<dd><p>v defaults to None.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.MultiDict.get">
<code class="descname">get</code><span class="sig-paren">(</span><em>key</em>, <em>default=None</em>, <em>type=None</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.MultiDict.get" title="Permalink to this definition"></a></dt>
<dd><p>Return the default value if the requested data doesn&#8217;t exist.
If <cite>type</cite> is provided and is a callable it should convert the value,
return it or raise a <code class="xref py py-exc docutils literal"><span class="pre">ValueError</span></code> if that is not possible.  In
this case the function will return the default as if the value was not
found:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">d</span> <span class="o">=</span> <span class="n">TypeConversionDict</span><span class="p">(</span><span class="n">foo</span><span class="o">=</span><span class="s1">&#39;42&#39;</span><span class="p">,</span> <span class="n">bar</span><span class="o">=</span><span class="s1">&#39;blub&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">d</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;foo&#39;</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="nb">int</span><span class="p">)</span>
<span class="go">42</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">d</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;bar&#39;</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="nb">int</span><span class="p">)</span>
<span class="go">-1</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>key</strong> &#8211; The key to be looked up.</li>
<li><strong>default</strong> &#8211; The default value to be returned if the key can&#8217;t
be looked up.  If not further specified <cite>None</cite> is
returned.</li>
<li><strong>type</strong> &#8211; A callable that is used to cast the value in the
<a class="reference internal" href="#werkzeug.datastructures.MultiDict" title="werkzeug.datastructures.MultiDict"><code class="xref py py-class docutils literal"><span class="pre">MultiDict</span></code></a>.  If a <code class="xref py py-exc docutils literal"><span class="pre">ValueError</span></code> is raised
by this callable the default value is returned.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.MultiDict.getlist">
<code class="descname">getlist</code><span class="sig-paren">(</span><em>key</em>, <em>type=None</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.MultiDict.getlist" title="Permalink to this definition"></a></dt>
<dd><p>Return the list of items for a given key. If that key is not in the
<cite>MultiDict</cite>, the return value will be an empty list.  Just as <cite>get</cite>
<cite>getlist</cite> accepts a <cite>type</cite> parameter.  All items will be converted
with the callable defined there.</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 simple">
<li><strong>key</strong> &#8211; The key to be looked up.</li>
<li><strong>type</strong> &#8211; A callable that is used to cast the value in the
<a class="reference internal" href="#werkzeug.datastructures.MultiDict" title="werkzeug.datastructures.MultiDict"><code class="xref py py-class docutils literal"><span class="pre">MultiDict</span></code></a>.  If a <code class="xref py py-exc docutils literal"><span class="pre">ValueError</span></code> is raised
by this callable the value will be removed from the list.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">a <code class="xref py py-class docutils literal"><span class="pre">list</span></code> of all the values for the key.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.MultiDict.has_key">
<code class="descname">has_key</code><span class="sig-paren">(</span><em>k</em><span class="sig-paren">)</span> &rarr; True if D has a key k, else False<a class="headerlink" href="#werkzeug.datastructures.MultiDict.has_key" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.MultiDict.items">
<code class="descname">items</code><span class="sig-paren">(</span><em>*a</em>, <em>**kw</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.MultiDict.items" title="Permalink to this definition"></a></dt>
<dd><p>Like <a class="reference internal" href="#werkzeug.datastructures.MultiDict.iteritems" title="werkzeug.datastructures.MultiDict.iteritems"><code class="xref py py-meth docutils literal"><span class="pre">iteritems()</span></code></a>, but returns a list.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.MultiDict.iteritems">
<code class="descname">iteritems</code><span class="sig-paren">(</span><em>multi=False</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.MultiDict.iteritems" title="Permalink to this definition"></a></dt>
<dd><p>Return an iterator of <code class="docutils literal"><span class="pre">(key,</span> <span class="pre">value)</span></code> pairs.</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>multi</strong> &#8211; If set to <cite>True</cite> the iterator returned will have a pair
for each value of each key.  Otherwise it will only
contain pairs for the first value of each key.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.MultiDict.iterlists">
<code class="descname">iterlists</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.MultiDict.iterlists" title="Permalink to this definition"></a></dt>
<dd><p>Return a list of <code class="docutils literal"><span class="pre">(key,</span> <span class="pre">values)</span></code> pairs, where values is the list
of all values associated with the key.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.MultiDict.iterlistvalues">
<code class="descname">iterlistvalues</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.MultiDict.iterlistvalues" title="Permalink to this definition"></a></dt>
<dd><p>Return an iterator of all values associated with a key.  Zipping
<a class="reference internal" href="#werkzeug.datastructures.MultiDict.keys" title="werkzeug.datastructures.MultiDict.keys"><code class="xref py py-meth docutils literal"><span class="pre">keys()</span></code></a> and this is the same as calling <a class="reference internal" href="#werkzeug.datastructures.MultiDict.lists" title="werkzeug.datastructures.MultiDict.lists"><code class="xref py py-meth docutils literal"><span class="pre">lists()</span></code></a>:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">d</span> <span class="o">=</span> <span class="n">MultiDict</span><span class="p">({</span><span class="s2">&quot;foo&quot;</span><span class="p">:</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">]})</span>
<span class="gp">&gt;&gt;&gt; </span><span class="nb">zip</span><span class="p">(</span><span class="n">d</span><span class="o">.</span><span class="n">keys</span><span class="p">(),</span> <span class="n">d</span><span class="o">.</span><span class="n">listvalues</span><span class="p">())</span> <span class="o">==</span> <span class="n">d</span><span class="o">.</span><span class="n">lists</span><span class="p">()</span>
<span class="go">True</span>
</pre></div>
</div>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.MultiDict.itervalues">
<code class="descname">itervalues</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.MultiDict.itervalues" title="Permalink to this definition"></a></dt>
<dd><p>Returns an iterator of the first value on every key&#8217;s value list.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.MultiDict.keys">
<code class="descname">keys</code><span class="sig-paren">(</span><em>*a</em>, <em>**kw</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.MultiDict.keys" title="Permalink to this definition"></a></dt>
<dd><p>Like <code class="xref py py-meth docutils literal"><span class="pre">iterkeys()</span></code>, but returns a list.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.MultiDict.lists">
<code class="descname">lists</code><span class="sig-paren">(</span><em>*a</em>, <em>**kw</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.MultiDict.lists" title="Permalink to this definition"></a></dt>
<dd><p>Like <a class="reference internal" href="#werkzeug.datastructures.MultiDict.iterlists" title="werkzeug.datastructures.MultiDict.iterlists"><code class="xref py py-meth docutils literal"><span class="pre">iterlists()</span></code></a>, but returns a list.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.MultiDict.listvalues">
<code class="descname">listvalues</code><span class="sig-paren">(</span><em>*a</em>, <em>**kw</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.MultiDict.listvalues" title="Permalink to this definition"></a></dt>
<dd><p>Like <a class="reference internal" href="#werkzeug.datastructures.MultiDict.iterlistvalues" title="werkzeug.datastructures.MultiDict.iterlistvalues"><code class="xref py py-meth docutils literal"><span class="pre">iterlistvalues()</span></code></a>, but returns a list.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.MultiDict.pop">
<code class="descname">pop</code><span class="sig-paren">(</span><em>key</em>, <em>default=no value</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.MultiDict.pop" title="Permalink to this definition"></a></dt>
<dd><p>Pop the first item for a list on the dict.  Afterwards the
key is removed from the dict, so additional values are discarded:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">d</span> <span class="o">=</span> <span class="n">MultiDict</span><span class="p">({</span><span class="s2">&quot;foo&quot;</span><span class="p">:</span> <span class="p">[</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">]})</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">d</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">&quot;foo&quot;</span><span class="p">)</span>
<span class="go">1</span>
<span class="gp">&gt;&gt;&gt; </span><span class="s2">&quot;foo&quot;</span> <span class="ow">in</span> <span class="n">d</span>
<span class="go">False</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>key</strong> &#8211; the key to pop.</li>
<li><strong>default</strong> &#8211; if provided the value to return if the key was
not in the dictionary.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.MultiDict.popitem">
<code class="descname">popitem</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.MultiDict.popitem" title="Permalink to this definition"></a></dt>
<dd><p>Pop an item from the dict.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.MultiDict.popitemlist">
<code class="descname">popitemlist</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.MultiDict.popitemlist" title="Permalink to this definition"></a></dt>
<dd><p>Pop a <code class="docutils literal"><span class="pre">(key,</span> <span class="pre">list)</span></code> tuple from the dict.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.MultiDict.poplist">
<code class="descname">poplist</code><span class="sig-paren">(</span><em>key</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.MultiDict.poplist" title="Permalink to this definition"></a></dt>
<dd><p>Pop the list for a key from the dict.  If the key is not in the dict
an empty list is returned.</p>
<div class="versionchanged">
<p><span class="versionmodified">Changed in version 0.5: </span>If the key does no longer exist a list is returned instead of
raising an error.</p>
</div>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.MultiDict.setdefault">
<code class="descname">setdefault</code><span class="sig-paren">(</span><em>key</em>, <em>default=None</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.MultiDict.setdefault" title="Permalink to this definition"></a></dt>
<dd><p>Returns the value for the key if it is in the dict, otherwise it
returns <cite>default</cite> and sets that value for <cite>key</cite>.</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>key</strong> &#8211; The key to be looked up.</li>
<li><strong>default</strong> &#8211; The default value to be returned if the key is not
in the dict.  If not further specified it&#8217;s <cite>None</cite>.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.MultiDict.setlist">
<code class="descname">setlist</code><span class="sig-paren">(</span><em>key</em>, <em>new_list</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.MultiDict.setlist" title="Permalink to this definition"></a></dt>
<dd><p>Remove the old values for a key and add new ones.  Note that the list
you pass the values in will be shallow-copied before it is inserted in
the dictionary.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">d</span> <span class="o">=</span> <span class="n">MultiDict</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">d</span><span class="o">.</span><span class="n">setlist</span><span class="p">(</span><span class="s1">&#39;foo&#39;</span><span class="p">,</span> <span class="p">[</span><span class="s1">&#39;1&#39;</span><span class="p">,</span> <span class="s1">&#39;2&#39;</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">d</span><span class="p">[</span><span class="s1">&#39;foo&#39;</span><span class="p">]</span>
<span class="go">&#39;1&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">d</span><span class="o">.</span><span class="n">getlist</span><span class="p">(</span><span class="s1">&#39;foo&#39;</span><span class="p">)</span>
<span class="go">[&#39;1&#39;, &#39;2&#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>key</strong> &#8211; The key for which the values are set.</li>
<li><strong>new_list</strong> &#8211; An iterable with the new values for the key.  Old values
are removed first.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.MultiDict.setlistdefault">
<code class="descname">setlistdefault</code><span class="sig-paren">(</span><em>key</em>, <em>default_list=None</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.MultiDict.setlistdefault" title="Permalink to this definition"></a></dt>
<dd><p>Like <cite>setdefault</cite> but sets multiple values.  The list returned
is not a copy, but the list that is actually used internally.  This
means that you can put new values into the dict by appending items
to the list:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">d</span> <span class="o">=</span> <span class="n">MultiDict</span><span class="p">({</span><span class="s2">&quot;foo&quot;</span><span class="p">:</span> <span class="mi">1</span><span class="p">})</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">d</span><span class="o">.</span><span class="n">setlistdefault</span><span class="p">(</span><span class="s2">&quot;foo&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">extend</span><span class="p">([</span><span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">d</span><span class="o">.</span><span class="n">getlist</span><span class="p">(</span><span class="s2">&quot;foo&quot;</span><span class="p">)</span>
<span class="go">[1, 2, 3]</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 simple">
<li><strong>key</strong> &#8211; The key to be looked up.</li>
<li><strong>default</strong> &#8211; An iterable of default values.  It is either copied
(in case it was a list) or converted into a list
before returned.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">a <code class="xref py py-class docutils literal"><span class="pre">list</span></code></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.MultiDict.to_dict">
<code class="descname">to_dict</code><span class="sig-paren">(</span><em>flat=True</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.MultiDict.to_dict" title="Permalink to this definition"></a></dt>
<dd><p>Return the contents as regular dict.  If <cite>flat</cite> is <cite>True</cite> the
returned dict will only have the first item present, if <cite>flat</cite> is
<cite>False</cite> all values will be returned as lists.</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>flat</strong> &#8211; If set to <cite>False</cite> the dict returned will have lists
with all the values in it.  Otherwise it will only
contain the first value for each key.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">a <code class="xref py py-class docutils literal"><span class="pre">dict</span></code></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.MultiDict.update">
<code class="descname">update</code><span class="sig-paren">(</span><em>other_dict</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.MultiDict.update" title="Permalink to this definition"></a></dt>
<dd><p>update() extends rather than replaces existing key lists.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.MultiDict.values">
<code class="descname">values</code><span class="sig-paren">(</span><em>*a</em>, <em>**kw</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.MultiDict.values" title="Permalink to this definition"></a></dt>
<dd><p>Like <a class="reference internal" href="#werkzeug.datastructures.MultiDict.itervalues" title="werkzeug.datastructures.MultiDict.itervalues"><code class="xref py py-meth docutils literal"><span class="pre">itervalues()</span></code></a>, but returns a list.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.MultiDict.viewitems">
<code class="descname">viewitems</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &rarr; a set-like object providing a view on D's items<a class="headerlink" href="#werkzeug.datastructures.MultiDict.viewitems" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.MultiDict.viewkeys">
<code class="descname">viewkeys</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &rarr; a set-like object providing a view on D's keys<a class="headerlink" href="#werkzeug.datastructures.MultiDict.viewkeys" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.MultiDict.viewvalues">
<code class="descname">viewvalues</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &rarr; an object providing a view on D's values<a class="headerlink" href="#werkzeug.datastructures.MultiDict.viewvalues" title="Permalink to this definition"></a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="werkzeug.datastructures.OrderedMultiDict">
<em class="property">class </em><code class="descclassname">werkzeug.datastructures.</code><code class="descname">OrderedMultiDict</code><span class="sig-paren">(</span><em>mapping=None</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.OrderedMultiDict" title="Permalink to this definition"></a></dt>
<dd><p>Works like a regular <a class="reference internal" href="#werkzeug.datastructures.MultiDict" title="werkzeug.datastructures.MultiDict"><code class="xref py py-class docutils literal"><span class="pre">MultiDict</span></code></a> but preserves the
order of the fields.  To convert the ordered multi dict into a
list you can use the <code class="xref py py-meth docutils literal"><span class="pre">items()</span></code> method and pass it <code class="docutils literal"><span class="pre">multi=True</span></code>.</p>
<p>In general an <a class="reference internal" href="#werkzeug.datastructures.OrderedMultiDict" title="werkzeug.datastructures.OrderedMultiDict"><code class="xref py py-class docutils literal"><span class="pre">OrderedMultiDict</span></code></a> is an order of magnitude
slower than a <a class="reference internal" href="#werkzeug.datastructures.MultiDict" title="werkzeug.datastructures.MultiDict"><code class="xref py py-class docutils literal"><span class="pre">MultiDict</span></code></a>.</p>
<div class="admonition-note admonition">
<p class="first admonition-title">note</p>
<p class="last">Due to a limitation in Python you cannot convert an ordered
multi dict into a regular dict by using <code class="docutils literal"><span class="pre">dict(multidict)</span></code>.
Instead you have to use the <code class="xref py py-meth docutils literal"><span class="pre">to_dict()</span></code> method, otherwise
the internal bucket objects are exposed.</p>
</div>
</dd></dl>

<dl class="class">
<dt id="werkzeug.datastructures.ImmutableMultiDict">
<em class="property">class </em><code class="descclassname">werkzeug.datastructures.</code><code class="descname">ImmutableMultiDict</code><span class="sig-paren">(</span><em>mapping=None</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.ImmutableMultiDict" title="Permalink to this definition"></a></dt>
<dd><p>An immutable <a class="reference internal" href="#werkzeug.datastructures.MultiDict" title="werkzeug.datastructures.MultiDict"><code class="xref py py-class docutils literal"><span class="pre">MultiDict</span></code></a>.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.5.</span></p>
</div>
<dl class="method">
<dt id="werkzeug.datastructures.ImmutableMultiDict.copy">
<code class="descname">copy</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.ImmutableMultiDict.copy" title="Permalink to this definition"></a></dt>
<dd><p>Return a shallow mutable copy of this object.  Keep in mind that
the standard library&#8217;s <a class="reference internal" href="#werkzeug.datastructures.ImmutableMultiDict.copy" title="werkzeug.datastructures.ImmutableMultiDict.copy"><code class="xref py py-func docutils literal"><span class="pre">copy()</span></code></a> function is a no-op for this class
like for any other python immutable type (eg: <code class="xref py py-class docutils literal"><span class="pre">tuple</span></code>).</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="werkzeug.datastructures.ImmutableOrderedMultiDict">
<em class="property">class </em><code class="descclassname">werkzeug.datastructures.</code><code class="descname">ImmutableOrderedMultiDict</code><span class="sig-paren">(</span><em>mapping=None</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.ImmutableOrderedMultiDict" title="Permalink to this definition"></a></dt>
<dd><p>An immutable <a class="reference internal" href="#werkzeug.datastructures.OrderedMultiDict" title="werkzeug.datastructures.OrderedMultiDict"><code class="xref py py-class docutils literal"><span class="pre">OrderedMultiDict</span></code></a>.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.6.</span></p>
</div>
<dl class="method">
<dt id="werkzeug.datastructures.ImmutableOrderedMultiDict.copy">
<code class="descname">copy</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.ImmutableOrderedMultiDict.copy" title="Permalink to this definition"></a></dt>
<dd><p>Return a shallow mutable copy of this object.  Keep in mind that
the standard library&#8217;s <a class="reference internal" href="#werkzeug.datastructures.ImmutableOrderedMultiDict.copy" title="werkzeug.datastructures.ImmutableOrderedMultiDict.copy"><code class="xref py py-func docutils literal"><span class="pre">copy()</span></code></a> function is a no-op for this class
like for any other python immutable type (eg: <code class="xref py py-class docutils literal"><span class="pre">tuple</span></code>).</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="werkzeug.datastructures.CombinedMultiDict">
<em class="property">class </em><code class="descclassname">werkzeug.datastructures.</code><code class="descname">CombinedMultiDict</code><span class="sig-paren">(</span><em>dicts=None</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.CombinedMultiDict" title="Permalink to this definition"></a></dt>
<dd><p>A read only <a class="reference internal" href="#werkzeug.datastructures.MultiDict" title="werkzeug.datastructures.MultiDict"><code class="xref py py-class docutils literal"><span class="pre">MultiDict</span></code></a> that you can pass multiple <a class="reference internal" href="#werkzeug.datastructures.MultiDict" title="werkzeug.datastructures.MultiDict"><code class="xref py py-class docutils literal"><span class="pre">MultiDict</span></code></a>
instances as sequence and it will combine the return values of all wrapped
dicts:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">werkzeug.datastructures</span> <span class="kn">import</span> <span class="n">CombinedMultiDict</span><span class="p">,</span> <span class="n">MultiDict</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">post</span> <span class="o">=</span> <span class="n">MultiDict</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="gp">&gt;&gt;&gt; </span><span class="n">get</span> <span class="o">=</span> <span class="n">MultiDict</span><span class="p">([(</span><span class="s1">&#39;blub&#39;</span><span class="p">,</span> <span class="s1">&#39;blah&#39;</span><span class="p">)])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">combined</span> <span class="o">=</span> <span class="n">CombinedMultiDict</span><span class="p">([</span><span class="n">get</span><span class="p">,</span> <span class="n">post</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">combined</span><span class="p">[</span><span class="s1">&#39;foo&#39;</span><span class="p">]</span>
<span class="go">&#39;bar&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">combined</span><span class="p">[</span><span class="s1">&#39;blub&#39;</span><span class="p">]</span>
<span class="go">&#39;blah&#39;</span>
</pre></div>
</div>
<p>This works for all read operations and will raise a <cite>TypeError</cite> for
methods that usually change data which isn&#8217;t possible.</p>
<p>From Werkzeug 0.3 onwards, the <cite>KeyError</cite> raised by this class is also a
subclass of the <code class="xref py py-exc docutils literal"><span class="pre">BadRequest</span></code> HTTP exception and will
render a page for a <code class="docutils literal"><span class="pre">400</span> <span class="pre">BAD</span> <span class="pre">REQUEST</span></code> if caught in a catch-all for HTTP
exceptions.</p>
</dd></dl>

<dl class="class">
<dt id="werkzeug.datastructures.ImmutableDict">
<em class="property">class </em><code class="descclassname">werkzeug.datastructures.</code><code class="descname">ImmutableDict</code><a class="headerlink" href="#werkzeug.datastructures.ImmutableDict" title="Permalink to this definition"></a></dt>
<dd><p>An immutable <code class="xref py py-class docutils literal"><span class="pre">dict</span></code>.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.5.</span></p>
</div>
<dl class="method">
<dt id="werkzeug.datastructures.ImmutableDict.copy">
<code class="descname">copy</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.ImmutableDict.copy" title="Permalink to this definition"></a></dt>
<dd><p>Return a shallow mutable copy of this object.  Keep in mind that
the standard library&#8217;s <a class="reference internal" href="#werkzeug.datastructures.ImmutableDict.copy" title="werkzeug.datastructures.ImmutableDict.copy"><code class="xref py py-func docutils literal"><span class="pre">copy()</span></code></a> function is a no-op for this class
like for any other python immutable type (eg: <code class="xref py py-class docutils literal"><span class="pre">tuple</span></code>).</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="werkzeug.datastructures.ImmutableList">
<em class="property">class </em><code class="descclassname">werkzeug.datastructures.</code><code class="descname">ImmutableList</code><a class="headerlink" href="#werkzeug.datastructures.ImmutableList" title="Permalink to this definition"></a></dt>
<dd><p>An immutable <code class="xref py py-class docutils literal"><span class="pre">list</span></code>.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.5.</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">Private:</th><td class="field-body"></td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="class">
<dt id="werkzeug.datastructures.FileMultiDict">
<em class="property">class </em><code class="descclassname">werkzeug.datastructures.</code><code class="descname">FileMultiDict</code><span class="sig-paren">(</span><em>mapping=None</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.FileMultiDict" title="Permalink to this definition"></a></dt>
<dd><p>A special <a class="reference internal" href="#werkzeug.datastructures.MultiDict" title="werkzeug.datastructures.MultiDict"><code class="xref py py-class docutils literal"><span class="pre">MultiDict</span></code></a> that has convenience methods to add
files to it.  This is used for <code class="xref py py-class docutils literal"><span class="pre">EnvironBuilder</span></code> and generally
useful for unittesting.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.5.</span></p>
</div>
<dl class="method">
<dt id="werkzeug.datastructures.FileMultiDict.add_file">
<code class="descname">add_file</code><span class="sig-paren">(</span><em>name</em>, <em>file</em>, <em>filename=None</em>, <em>content_type=None</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.FileMultiDict.add_file" title="Permalink to this definition"></a></dt>
<dd><p>Adds a new file to the dict.  <cite>file</cite> can be a file name or
a <code class="xref py py-class docutils literal"><span class="pre">file</span></code>-like or a <a class="reference internal" href="#werkzeug.datastructures.FileStorage" title="werkzeug.datastructures.FileStorage"><code class="xref py py-class docutils literal"><span class="pre">FileStorage</span></code></a> object.</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>name</strong> &#8211; the name of the field.</li>
<li><strong>file</strong> &#8211; a filename or <code class="xref py py-class docutils literal"><span class="pre">file</span></code>-like object</li>
<li><strong>filename</strong> &#8211; an optional filename</li>
<li><strong>content_type</strong> &#8211; an optional content type</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="http-related">
<span id="http-datastructures"></span><h2>HTTP Related<a class="headerlink" href="#http-related" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt id="werkzeug.datastructures.Headers">
<em class="property">class </em><code class="descclassname">werkzeug.datastructures.</code><code class="descname">Headers</code><span class="sig-paren">(</span><span class="optional">[</span><em>defaults</em><span class="optional">]</span><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.Headers" title="Permalink to this definition"></a></dt>
<dd><p>An object that stores some headers.  It has a dict-like interface
but is ordered and can store the same keys multiple times.</p>
<p>This data structure is useful if you want a nicer way to handle WSGI
headers which are stored as tuples in a list.</p>
<p>From Werkzeug 0.3 onwards, the <code class="xref py py-exc docutils literal"><span class="pre">KeyError</span></code> raised by this class is
also a subclass of the <code class="xref py py-class docutils literal"><span class="pre">BadRequest</span></code> HTTP exception
and will render a page for a <code class="docutils literal"><span class="pre">400</span> <span class="pre">BAD</span> <span class="pre">REQUEST</span></code> if caught in a
catch-all for HTTP exceptions.</p>
<p>Headers is mostly compatible with the Python <code class="xref py py-class docutils literal"><span class="pre">wsgiref.headers.Headers</span></code>
class, with the exception of <cite>__getitem__</cite>.  <code class="xref py py-mod docutils literal"><span class="pre">wsgiref</span></code> will return
<cite>None</cite> for <code class="docutils literal"><span class="pre">headers['missing']</span></code>, whereas <a class="reference internal" href="#werkzeug.datastructures.Headers" title="werkzeug.datastructures.Headers"><code class="xref py py-class docutils literal"><span class="pre">Headers</span></code></a> will raise
a <code class="xref py py-class docutils literal"><span class="pre">KeyError</span></code>.</p>
<p>To create a new <a class="reference internal" href="#werkzeug.datastructures.Headers" title="werkzeug.datastructures.Headers"><code class="xref py py-class docutils literal"><span class="pre">Headers</span></code></a> object pass it a list or dict of headers
which are used as default values.  This does not reuse the list passed
to the constructor for internal usage.</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>defaults</strong> &#8211; The list of default values for the <a class="reference internal" href="#werkzeug.datastructures.Headers" title="werkzeug.datastructures.Headers"><code class="xref py py-class docutils literal"><span class="pre">Headers</span></code></a>.</td>
</tr>
</tbody>
</table>
<div class="versionchanged">
<p><span class="versionmodified">Changed in version 0.9: </span>This data structure now stores unicode values similar to how the
multi dicts do it.  The main difference is that bytes can be set as
well which will automatically be latin1 decoded.</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified">Changed in version 0.9: </span>The <code class="xref py py-meth docutils literal"><span class="pre">linked()</span></code> function was removed without replacement as it
was an API that does not support the changes to the encoding model.</p>
</div>
<dl class="method">
<dt id="werkzeug.datastructures.Headers.add">
<code class="descname">add</code><span class="sig-paren">(</span><em>_key</em>, <em>_value</em>, <em>**kw</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.Headers.add" title="Permalink to this definition"></a></dt>
<dd><p>Add a new header tuple to the list.</p>
<p>Keyword arguments can specify additional parameters for the header
value, with underscores converted to dashes:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">d</span> <span class="o">=</span> <span class="n">Headers</span><span class="p">()</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">d</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="s1">&#39;Content-Type&#39;</span><span class="p">,</span> <span class="s1">&#39;text/plain&#39;</span><span class="p">)</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">d</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="s1">&#39;Content-Disposition&#39;</span><span class="p">,</span> <span class="s1">&#39;attachment&#39;</span><span class="p">,</span> <span class="n">filename</span><span class="o">=</span><span class="s1">&#39;foo.png&#39;</span><span class="p">)</span>
</pre></div>
</div>
<p>The keyword argument dumping uses <code class="xref py py-func docutils literal"><span class="pre">dump_options_header()</span></code>
behind the scenes.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.4.1: </span>keyword arguments were added for <code class="xref py py-mod docutils literal"><span class="pre">wsgiref</span></code> compatibility.</p>
</div>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.Headers.add_header">
<code class="descname">add_header</code><span class="sig-paren">(</span><em>_key</em>, <em>_value</em>, <em>**_kw</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.Headers.add_header" title="Permalink to this definition"></a></dt>
<dd><p>Add a new header tuple to the list.</p>
<p>An alias for <a class="reference internal" href="#werkzeug.datastructures.Headers.add" title="werkzeug.datastructures.Headers.add"><code class="xref py py-meth docutils literal"><span class="pre">add()</span></code></a> for compatibility with the <code class="xref py py-mod docutils literal"><span class="pre">wsgiref</span></code>
<code class="xref py py-meth docutils literal"><span class="pre">add_header()</span></code> method.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.Headers.clear">
<code class="descname">clear</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.Headers.clear" title="Permalink to this definition"></a></dt>
<dd><p>Clears all headers.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.Headers.extend">
<code class="descname">extend</code><span class="sig-paren">(</span><em>iterable</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.Headers.extend" title="Permalink to this definition"></a></dt>
<dd><p>Extend the headers with a dict or an iterable yielding keys and
values.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.Headers.get">
<code class="descname">get</code><span class="sig-paren">(</span><em>key</em>, <em>default=None</em>, <em>type=None</em>, <em>as_bytes=False</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.Headers.get" title="Permalink to this definition"></a></dt>
<dd><p>Return the default value if the requested data doesn&#8217;t exist.
If <cite>type</cite> is provided and is a callable it should convert the value,
return it or raise a <code class="xref py py-exc docutils literal"><span class="pre">ValueError</span></code> if that is not possible.  In
this case the function will return the default as if the value was not
found:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">d</span> <span class="o">=</span> <span class="n">Headers</span><span class="p">([(</span><span class="s1">&#39;Content-Length&#39;</span><span class="p">,</span> <span class="s1">&#39;42&#39;</span><span class="p">)])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">d</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;Content-Length&#39;</span><span class="p">,</span> <span class="nb">type</span><span class="o">=</span><span class="nb">int</span><span class="p">)</span>
<span class="go">42</span>
</pre></div>
</div>
<p>If a headers object is bound you must not add unicode strings
because no encoding takes place.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.9: </span>Added support for <cite>as_bytes</cite>.</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>key</strong> &#8211; The key to be looked up.</li>
<li><strong>default</strong> &#8211; The default value to be returned if the key can&#8217;t
be looked up.  If not further specified <cite>None</cite> is
returned.</li>
<li><strong>type</strong> &#8211; A callable that is used to cast the value in the
<a class="reference internal" href="#werkzeug.datastructures.Headers" title="werkzeug.datastructures.Headers"><code class="xref py py-class docutils literal"><span class="pre">Headers</span></code></a>.  If a <code class="xref py py-exc docutils literal"><span class="pre">ValueError</span></code> is raised
by this callable the default value is returned.</li>
<li><strong>as_bytes</strong> &#8211; return bytes instead of unicode strings.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.Headers.get_all">
<code class="descname">get_all</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.Headers.get_all" title="Permalink to this definition"></a></dt>
<dd><p>Return a list of all the values for the named field.</p>
<p>This method is compatible with the <code class="xref py py-mod docutils literal"><span class="pre">wsgiref</span></code>
<code class="xref py py-meth docutils literal"><span class="pre">get_all()</span></code> method.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.Headers.getlist">
<code class="descname">getlist</code><span class="sig-paren">(</span><em>key</em>, <em>type=None</em>, <em>as_bytes=False</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.Headers.getlist" title="Permalink to this definition"></a></dt>
<dd><p>Return the list of items for a given key. If that key is not in the
<a class="reference internal" href="#werkzeug.datastructures.Headers" title="werkzeug.datastructures.Headers"><code class="xref py py-class docutils literal"><span class="pre">Headers</span></code></a>, the return value will be an empty list.  Just as
<a class="reference internal" href="#werkzeug.datastructures.Headers.get" title="werkzeug.datastructures.Headers.get"><code class="xref py py-meth docutils literal"><span class="pre">get()</span></code></a> <a class="reference internal" href="#werkzeug.datastructures.Headers.getlist" title="werkzeug.datastructures.Headers.getlist"><code class="xref py py-meth docutils literal"><span class="pre">getlist()</span></code></a> accepts a <cite>type</cite> parameter.  All items will
be converted with the callable defined there.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.9: </span>Added support for <cite>as_bytes</cite>.</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 simple">
<li><strong>key</strong> &#8211; The key to be looked up.</li>
<li><strong>type</strong> &#8211; A callable that is used to cast the value in the
<a class="reference internal" href="#werkzeug.datastructures.Headers" title="werkzeug.datastructures.Headers"><code class="xref py py-class docutils literal"><span class="pre">Headers</span></code></a>.  If a <code class="xref py py-exc docutils literal"><span class="pre">ValueError</span></code> is raised
by this callable the value will be removed from the list.</li>
<li><strong>as_bytes</strong> &#8211; return bytes instead of unicode strings.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">a <code class="xref py py-class docutils literal"><span class="pre">list</span></code> of all the values for the key.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.Headers.has_key">
<code class="descname">has_key</code><span class="sig-paren">(</span><em>key</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.Headers.has_key" title="Permalink to this definition"></a></dt>
<dd><p>Check if a key is present.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.Headers.items">
<code class="descname">items</code><span class="sig-paren">(</span><em>*a</em>, <em>**kw</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.Headers.items" title="Permalink to this definition"></a></dt>
<dd><p>Like <code class="xref py py-meth docutils literal"><span class="pre">iteritems()</span></code>, but returns a list.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.Headers.keys">
<code class="descname">keys</code><span class="sig-paren">(</span><em>*a</em>, <em>**kw</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.Headers.keys" title="Permalink to this definition"></a></dt>
<dd><p>Like <code class="xref py py-meth docutils literal"><span class="pre">iterkeys()</span></code>, but returns a list.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.Headers.pop">
<code class="descname">pop</code><span class="sig-paren">(</span><em>key=None</em>, <em>default=no value</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.Headers.pop" title="Permalink to this definition"></a></dt>
<dd><p>Removes and returns a key or index.</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>key</strong> &#8211; The key to be popped.  If this is an integer the item at
that position is removed, if it&#8217;s a string the value for
that key is.  If the key is omitted or <cite>None</cite> the last
item is removed.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">an item.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.Headers.popitem">
<code class="descname">popitem</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.Headers.popitem" title="Permalink to this definition"></a></dt>
<dd><p>Removes a key or index and returns a (key, value) item.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.Headers.remove">
<code class="descname">remove</code><span class="sig-paren">(</span><em>key</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.Headers.remove" title="Permalink to this definition"></a></dt>
<dd><p>Remove a key.</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>key</strong> &#8211; The key to be removed.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.Headers.set">
<code class="descname">set</code><span class="sig-paren">(</span><em>_key</em>, <em>_value</em>, <em>**kw</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.Headers.set" title="Permalink to this definition"></a></dt>
<dd><p>Remove all header tuples for <cite>key</cite> and add a new one.  The newly
added key either appears at the end of the list if there was no
entry or replaces the first one.</p>
<p>Keyword arguments can specify additional parameters for the header
value, with underscores converted to dashes.  See <a class="reference internal" href="#werkzeug.datastructures.Headers.add" title="werkzeug.datastructures.Headers.add"><code class="xref py py-meth docutils literal"><span class="pre">add()</span></code></a> for
more information.</p>
<div class="versionchanged">
<p><span class="versionmodified">Changed in version 0.6.1: </span><a class="reference internal" href="#werkzeug.datastructures.Headers.set" title="werkzeug.datastructures.Headers.set"><code class="xref py py-meth docutils literal"><span class="pre">set()</span></code></a> now accepts the same arguments as <a class="reference internal" href="#werkzeug.datastructures.Headers.add" title="werkzeug.datastructures.Headers.add"><code class="xref py py-meth docutils literal"><span class="pre">add()</span></code></a>.</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>key</strong> &#8211; The key to be inserted.</li>
<li><strong>value</strong> &#8211; The value to be inserted.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.Headers.setdefault">
<code class="descname">setdefault</code><span class="sig-paren">(</span><em>key</em>, <em>value</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.Headers.setdefault" title="Permalink to this definition"></a></dt>
<dd><p>Returns the value for the key if it is in the dict, otherwise it
returns <cite>default</cite> and sets that value for <cite>key</cite>.</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>key</strong> &#8211; The key to be looked up.</li>
<li><strong>default</strong> &#8211; The default value to be returned if the key is not
in the dict.  If not further specified it&#8217;s <cite>None</cite>.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.Headers.to_list">
<code class="descname">to_list</code><span class="sig-paren">(</span><em>charset='iso-8859-1'</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.Headers.to_list" title="Permalink to this definition"></a></dt>
<dd><p>Convert the headers into a list suitable for WSGI.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.Headers.to_wsgi_list">
<code class="descname">to_wsgi_list</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.Headers.to_wsgi_list" title="Permalink to this definition"></a></dt>
<dd><p>Convert the headers into a list suitable for WSGI.</p>
<p>The values are byte strings in Python 2 converted to latin1 and unicode
strings in Python 3 for the WSGI server to encode.</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">Returns:</th><td class="field-body">list</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.Headers.values">
<code class="descname">values</code><span class="sig-paren">(</span><em>*a</em>, <em>**kw</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.Headers.values" title="Permalink to this definition"></a></dt>
<dd><p>Like <code class="xref py py-meth docutils literal"><span class="pre">itervalues()</span></code>, but returns a list.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="werkzeug.datastructures.EnvironHeaders">
<em class="property">class </em><code class="descclassname">werkzeug.datastructures.</code><code class="descname">EnvironHeaders</code><span class="sig-paren">(</span><em>environ</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.EnvironHeaders" title="Permalink to this definition"></a></dt>
<dd><p>Read only version of the headers from a WSGI environment.  This
provides the same interface as <cite>Headers</cite> and is constructed from
a WSGI environment.</p>
<p>From Werkzeug 0.3 onwards, the <cite>KeyError</cite> raised by this class is also a
subclass of the <code class="xref py py-exc docutils literal"><span class="pre">BadRequest</span></code> HTTP exception and will
render a page for a <code class="docutils literal"><span class="pre">400</span> <span class="pre">BAD</span> <span class="pre">REQUEST</span></code> if caught in a catch-all for
HTTP exceptions.</p>
</dd></dl>

<dl class="class">
<dt id="werkzeug.datastructures.HeaderSet">
<em class="property">class </em><code class="descclassname">werkzeug.datastructures.</code><code class="descname">HeaderSet</code><span class="sig-paren">(</span><em>headers=None</em>, <em>on_update=None</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.HeaderSet" title="Permalink to this definition"></a></dt>
<dd><p>Similar to the <a class="reference internal" href="#werkzeug.datastructures.ETags" title="werkzeug.datastructures.ETags"><code class="xref py py-class docutils literal"><span class="pre">ETags</span></code></a> class this implements a set-like structure.
Unlike <a class="reference internal" href="#werkzeug.datastructures.ETags" title="werkzeug.datastructures.ETags"><code class="xref py py-class docutils literal"><span class="pre">ETags</span></code></a> this is case insensitive and used for vary, allow, and
content-language headers.</p>
<p>If not constructed using the <code class="xref py py-func docutils literal"><span class="pre">parse_set_header()</span></code> function the
instantiation works like this:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">hs</span> <span class="o">=</span> <span class="n">HeaderSet</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="s1">&#39;baz&#39;</span><span class="p">])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">hs</span>
<span class="go">HeaderSet([&#39;foo&#39;, &#39;bar&#39;, &#39;baz&#39;])</span>
</pre></div>
</div>
<dl class="method">
<dt id="werkzeug.datastructures.HeaderSet.add">
<code class="descname">add</code><span class="sig-paren">(</span><em>header</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.HeaderSet.add" title="Permalink to this definition"></a></dt>
<dd><p>Add a new header to the set.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.HeaderSet.as_set">
<code class="descname">as_set</code><span class="sig-paren">(</span><em>preserve_casing=False</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.HeaderSet.as_set" title="Permalink to this definition"></a></dt>
<dd><p>Return the set as real python set type.  When calling this, all
the items are converted to lowercase and the ordering is lost.</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>preserve_casing</strong> &#8211; if set to <cite>True</cite> the items in the set returned
will have the original case like in the
<a class="reference internal" href="#werkzeug.datastructures.HeaderSet" title="werkzeug.datastructures.HeaderSet"><code class="xref py py-class docutils literal"><span class="pre">HeaderSet</span></code></a>, otherwise they will
be lowercase.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.HeaderSet.clear">
<code class="descname">clear</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.HeaderSet.clear" title="Permalink to this definition"></a></dt>
<dd><p>Clear the set.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.HeaderSet.discard">
<code class="descname">discard</code><span class="sig-paren">(</span><em>header</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.HeaderSet.discard" title="Permalink to this definition"></a></dt>
<dd><p>Like <a class="reference internal" href="#werkzeug.datastructures.HeaderSet.remove" title="werkzeug.datastructures.HeaderSet.remove"><code class="xref py py-meth docutils literal"><span class="pre">remove()</span></code></a> but ignores errors.</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>header</strong> &#8211; the header to be discarded.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.HeaderSet.find">
<code class="descname">find</code><span class="sig-paren">(</span><em>header</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.HeaderSet.find" title="Permalink to this definition"></a></dt>
<dd><p>Return the index of the header in the set or return -1 if not found.</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>header</strong> &#8211; the header to be looked up.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.HeaderSet.index">
<code class="descname">index</code><span class="sig-paren">(</span><em>header</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.HeaderSet.index" title="Permalink to this definition"></a></dt>
<dd><p>Return the index of the header in the set or raise an
<code class="xref py py-exc docutils literal"><span class="pre">IndexError</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>header</strong> &#8211; the header to be looked up.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.HeaderSet.remove">
<code class="descname">remove</code><span class="sig-paren">(</span><em>header</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.HeaderSet.remove" title="Permalink to this definition"></a></dt>
<dd><p>Remove a header from the set.  This raises an <code class="xref py py-exc docutils literal"><span class="pre">KeyError</span></code> if the
header is not in the set.</p>
<div class="versionchanged">
<p><span class="versionmodified">Changed in version 0.5: </span>In older versions a <code class="xref py py-exc docutils literal"><span class="pre">IndexError</span></code> was raised instead of a
<code class="xref py py-exc docutils literal"><span class="pre">KeyError</span></code> if the object was missing.</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"><strong>header</strong> &#8211; the header to be removed.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.HeaderSet.to_header">
<code class="descname">to_header</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.HeaderSet.to_header" title="Permalink to this definition"></a></dt>
<dd><p>Convert the header set into an HTTP header string.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.HeaderSet.update">
<code class="descname">update</code><span class="sig-paren">(</span><em>iterable</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.HeaderSet.update" title="Permalink to this definition"></a></dt>
<dd><p>Add all the headers from the iterable to the set.</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>iterable</strong> &#8211; updates the set with the items from the iterable.</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="werkzeug.datastructures.Accept">
<em class="property">class </em><code class="descclassname">werkzeug.datastructures.</code><code class="descname">Accept</code><span class="sig-paren">(</span><em>values=()</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.Accept" title="Permalink to this definition"></a></dt>
<dd><p>An <a class="reference internal" href="#werkzeug.datastructures.Accept" title="werkzeug.datastructures.Accept"><code class="xref py py-class docutils literal"><span class="pre">Accept</span></code></a> object is just a list subclass for lists of
<code class="docutils literal"><span class="pre">(value,</span> <span class="pre">quality)</span></code> tuples.  It is automatically sorted by quality.</p>
<p>All <a class="reference internal" href="#werkzeug.datastructures.Accept" title="werkzeug.datastructures.Accept"><code class="xref py py-class docutils literal"><span class="pre">Accept</span></code></a> objects work similar to a list but provide extra
functionality for working with the data.  Containment checks are
normalized to the rules of that header:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">a</span> <span class="o">=</span> <span class="n">CharsetAccept</span><span class="p">([(</span><span class="s1">&#39;ISO-8859-1&#39;</span><span class="p">,</span> <span class="mi">1</span><span class="p">),</span> <span class="p">(</span><span class="s1">&#39;utf-8&#39;</span><span class="p">,</span> <span class="mf">0.7</span><span class="p">)])</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span><span class="o">.</span><span class="n">best</span>
<span class="go">&#39;ISO-8859-1&#39;</span>
<span class="gp">&gt;&gt;&gt; </span><span class="s1">&#39;iso-8859-1&#39;</span> <span class="ow">in</span> <span class="n">a</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="s1">&#39;UTF8&#39;</span> <span class="ow">in</span> <span class="n">a</span>
<span class="go">True</span>
<span class="gp">&gt;&gt;&gt; </span><span class="s1">&#39;utf7&#39;</span> <span class="ow">in</span> <span class="n">a</span>
<span class="go">False</span>
</pre></div>
</div>
<p>To get the quality for an item you can use normal item lookup:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="k">print</span> <span class="n">a</span><span class="p">[</span><span class="s1">&#39;utf-8&#39;</span><span class="p">]</span>
<span class="go">0.7</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">a</span><span class="p">[</span><span class="s1">&#39;utf7&#39;</span><span class="p">]</span>
<span class="go">0</span>
</pre></div>
</div>
<div class="versionchanged">
<p><span class="versionmodified">Changed in version 0.5: </span><a class="reference internal" href="#werkzeug.datastructures.Accept" title="werkzeug.datastructures.Accept"><code class="xref py py-class docutils literal"><span class="pre">Accept</span></code></a> objects are forced immutable now.</p>
</div>
<dl class="attribute">
<dt id="werkzeug.datastructures.Accept.best">
<code class="descname">best</code><a class="headerlink" href="#werkzeug.datastructures.Accept.best" title="Permalink to this definition"></a></dt>
<dd><p>The best match as value.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.Accept.best_match">
<code class="descname">best_match</code><span class="sig-paren">(</span><em>matches</em>, <em>default=None</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.Accept.best_match" title="Permalink to this definition"></a></dt>
<dd><p>Returns the best match from a list of possible matches based
on the quality of the client.  If two items have the same quality,
the one is returned that comes first.</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>matches</strong> &#8211; a list of matches to check for</li>
<li><strong>default</strong> &#8211; the value that is returned if none match</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.Accept.find">
<code class="descname">find</code><span class="sig-paren">(</span><em>key</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.Accept.find" title="Permalink to this definition"></a></dt>
<dd><p>Get the position of an entry or return -1.</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>key</strong> &#8211; The key to be looked up.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.Accept.index">
<code class="descname">index</code><span class="sig-paren">(</span><em>key</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.Accept.index" title="Permalink to this definition"></a></dt>
<dd><p>Get the position of an entry or raise <code class="xref py py-exc docutils literal"><span class="pre">ValueError</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>key</strong> &#8211; The key to be looked up.</td>
</tr>
</tbody>
</table>
<div class="versionchanged">
<p><span class="versionmodified">Changed in version 0.5: </span>This used to raise <code class="xref py py-exc docutils literal"><span class="pre">IndexError</span></code>, which was inconsistent
with the list API.</p>
</div>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.Accept.itervalues">
<code class="descname">itervalues</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.Accept.itervalues" title="Permalink to this definition"></a></dt>
<dd><p>Iterate over all values.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.Accept.quality">
<code class="descname">quality</code><span class="sig-paren">(</span><em>key</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.Accept.quality" title="Permalink to this definition"></a></dt>
<dd><p>Returns the quality of the key.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.6: </span>In previous versions you had to use the item-lookup syntax
(eg: <code class="docutils literal"><span class="pre">obj[key]</span></code> instead of <code class="docutils literal"><span class="pre">obj.quality(key)</span></code>)</p>
</div>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.Accept.to_header">
<code class="descname">to_header</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.Accept.to_header" title="Permalink to this definition"></a></dt>
<dd><p>Convert the header set into an HTTP header string.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.Accept.values">
<code class="descname">values</code><span class="sig-paren">(</span><em>*a</em>, <em>**kw</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.Accept.values" title="Permalink to this definition"></a></dt>
<dd><p>Like <a class="reference internal" href="#werkzeug.datastructures.Accept.itervalues" title="werkzeug.datastructures.Accept.itervalues"><code class="xref py py-meth docutils literal"><span class="pre">itervalues()</span></code></a>, but returns a list.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="werkzeug.datastructures.MIMEAccept">
<em class="property">class </em><code class="descclassname">werkzeug.datastructures.</code><code class="descname">MIMEAccept</code><span class="sig-paren">(</span><em>values=()</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.MIMEAccept" title="Permalink to this definition"></a></dt>
<dd><p>Like <a class="reference internal" href="#werkzeug.datastructures.Accept" title="werkzeug.datastructures.Accept"><code class="xref py py-class docutils literal"><span class="pre">Accept</span></code></a> but with special methods and behavior for
mimetypes.</p>
<dl class="attribute">
<dt id="werkzeug.datastructures.MIMEAccept.accept_html">
<code class="descname">accept_html</code><a class="headerlink" href="#werkzeug.datastructures.MIMEAccept.accept_html" title="Permalink to this definition"></a></dt>
<dd><p>True if this object accepts HTML.</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.MIMEAccept.accept_json">
<code class="descname">accept_json</code><a class="headerlink" href="#werkzeug.datastructures.MIMEAccept.accept_json" title="Permalink to this definition"></a></dt>
<dd><p>True if this object accepts JSON.</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.MIMEAccept.accept_xhtml">
<code class="descname">accept_xhtml</code><a class="headerlink" href="#werkzeug.datastructures.MIMEAccept.accept_xhtml" title="Permalink to this definition"></a></dt>
<dd><p>True if this object accepts XHTML.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="werkzeug.datastructures.CharsetAccept">
<em class="property">class </em><code class="descclassname">werkzeug.datastructures.</code><code class="descname">CharsetAccept</code><span class="sig-paren">(</span><em>values=()</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.CharsetAccept" title="Permalink to this definition"></a></dt>
<dd><p>Like <a class="reference internal" href="#werkzeug.datastructures.Accept" title="werkzeug.datastructures.Accept"><code class="xref py py-class docutils literal"><span class="pre">Accept</span></code></a> but with normalization for charsets.</p>
</dd></dl>

<dl class="class">
<dt id="werkzeug.datastructures.LanguageAccept">
<em class="property">class </em><code class="descclassname">werkzeug.datastructures.</code><code class="descname">LanguageAccept</code><span class="sig-paren">(</span><em>values=()</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.LanguageAccept" title="Permalink to this definition"></a></dt>
<dd><p>Like <a class="reference internal" href="#werkzeug.datastructures.Accept" title="werkzeug.datastructures.Accept"><code class="xref py py-class docutils literal"><span class="pre">Accept</span></code></a> but with normalization for languages.</p>
</dd></dl>

<dl class="class">
<dt id="werkzeug.datastructures.RequestCacheControl">
<em class="property">class </em><code class="descclassname">werkzeug.datastructures.</code><code class="descname">RequestCacheControl</code><span class="sig-paren">(</span><em>values=()</em>, <em>on_update=None</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.RequestCacheControl" title="Permalink to this definition"></a></dt>
<dd><p>A cache control for requests.  This is immutable and gives access
to all the request-relevant cache control headers.</p>
<p>To get a header of the <a class="reference internal" href="#werkzeug.datastructures.RequestCacheControl" title="werkzeug.datastructures.RequestCacheControl"><code class="xref py py-class docutils literal"><span class="pre">RequestCacheControl</span></code></a> object again you can
convert the object into a string or call the <code class="xref py py-meth docutils literal"><span class="pre">to_header()</span></code> method.  If
you plan to subclass it and add your own items have a look at the sourcecode
for that class.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.5: </span>In previous versions a <cite>CacheControl</cite> class existed that was used
both for request and response.</p>
</div>
<dl class="attribute">
<dt id="werkzeug.datastructures.RequestCacheControl.no_cache">
<code class="descname">no_cache</code><a class="headerlink" href="#werkzeug.datastructures.RequestCacheControl.no_cache" title="Permalink to this definition"></a></dt>
<dd><p>accessor for &#8216;no-cache&#8217;</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.RequestCacheControl.no_store">
<code class="descname">no_store</code><a class="headerlink" href="#werkzeug.datastructures.RequestCacheControl.no_store" title="Permalink to this definition"></a></dt>
<dd><p>accessor for &#8216;no-store&#8217;</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.RequestCacheControl.max_age">
<code class="descname">max_age</code><a class="headerlink" href="#werkzeug.datastructures.RequestCacheControl.max_age" title="Permalink to this definition"></a></dt>
<dd><p>accessor for &#8216;max-age&#8217;</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.RequestCacheControl.no_transform">
<code class="descname">no_transform</code><a class="headerlink" href="#werkzeug.datastructures.RequestCacheControl.no_transform" title="Permalink to this definition"></a></dt>
<dd><p>accessor for &#8216;no-transform&#8217;</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.RequestCacheControl.max_stale">
<code class="descname">max_stale</code><a class="headerlink" href="#werkzeug.datastructures.RequestCacheControl.max_stale" title="Permalink to this definition"></a></dt>
<dd><p>accessor for &#8216;max-stale&#8217;</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.RequestCacheControl.min_fresh">
<code class="descname">min_fresh</code><a class="headerlink" href="#werkzeug.datastructures.RequestCacheControl.min_fresh" title="Permalink to this definition"></a></dt>
<dd><p>accessor for &#8216;min-fresh&#8217;</p>
</dd></dl>

<dl class="attribute">
<dt>
<code class="descname">no_transform</code></dt>
<dd><p>accessor for &#8216;no-transform&#8217;</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.RequestCacheControl.only_if_cached">
<code class="descname">only_if_cached</code><a class="headerlink" href="#werkzeug.datastructures.RequestCacheControl.only_if_cached" title="Permalink to this definition"></a></dt>
<dd><p>accessor for &#8216;only-if-cached&#8217;</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="werkzeug.datastructures.ResponseCacheControl">
<em class="property">class </em><code class="descclassname">werkzeug.datastructures.</code><code class="descname">ResponseCacheControl</code><span class="sig-paren">(</span><em>values=()</em>, <em>on_update=None</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.ResponseCacheControl" title="Permalink to this definition"></a></dt>
<dd><p>A cache control for responses.  Unlike <a class="reference internal" href="#werkzeug.datastructures.RequestCacheControl" title="werkzeug.datastructures.RequestCacheControl"><code class="xref py py-class docutils literal"><span class="pre">RequestCacheControl</span></code></a>
this is mutable and gives access to response-relevant cache control
headers.</p>
<p>To get a header of the <a class="reference internal" href="#werkzeug.datastructures.ResponseCacheControl" title="werkzeug.datastructures.ResponseCacheControl"><code class="xref py py-class docutils literal"><span class="pre">ResponseCacheControl</span></code></a> object again you can
convert the object into a string or call the <code class="xref py py-meth docutils literal"><span class="pre">to_header()</span></code> method.  If
you plan to subclass it and add your own items have a look at the sourcecode
for that class.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.5: </span>In previous versions a <cite>CacheControl</cite> class existed that was used
both for request and response.</p>
</div>
<dl class="attribute">
<dt id="werkzeug.datastructures.ResponseCacheControl.no_cache">
<code class="descname">no_cache</code><a class="headerlink" href="#werkzeug.datastructures.ResponseCacheControl.no_cache" title="Permalink to this definition"></a></dt>
<dd><p>accessor for &#8216;no-cache&#8217;</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.ResponseCacheControl.no_store">
<code class="descname">no_store</code><a class="headerlink" href="#werkzeug.datastructures.ResponseCacheControl.no_store" title="Permalink to this definition"></a></dt>
<dd><p>accessor for &#8216;no-store&#8217;</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.ResponseCacheControl.max_age">
<code class="descname">max_age</code><a class="headerlink" href="#werkzeug.datastructures.ResponseCacheControl.max_age" title="Permalink to this definition"></a></dt>
<dd><p>accessor for &#8216;max-age&#8217;</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.ResponseCacheControl.no_transform">
<code class="descname">no_transform</code><a class="headerlink" href="#werkzeug.datastructures.ResponseCacheControl.no_transform" title="Permalink to this definition"></a></dt>
<dd><p>accessor for &#8216;no-transform&#8217;</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.ResponseCacheControl.must_revalidate">
<code class="descname">must_revalidate</code><a class="headerlink" href="#werkzeug.datastructures.ResponseCacheControl.must_revalidate" title="Permalink to this definition"></a></dt>
<dd><p>accessor for &#8216;must-revalidate&#8217;</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.ResponseCacheControl.private">
<code class="descname">private</code><a class="headerlink" href="#werkzeug.datastructures.ResponseCacheControl.private" title="Permalink to this definition"></a></dt>
<dd><p>accessor for &#8216;private&#8217;</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.ResponseCacheControl.proxy_revalidate">
<code class="descname">proxy_revalidate</code><a class="headerlink" href="#werkzeug.datastructures.ResponseCacheControl.proxy_revalidate" title="Permalink to this definition"></a></dt>
<dd><p>accessor for &#8216;proxy-revalidate&#8217;</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.ResponseCacheControl.public">
<code class="descname">public</code><a class="headerlink" href="#werkzeug.datastructures.ResponseCacheControl.public" title="Permalink to this definition"></a></dt>
<dd><p>accessor for &#8216;public&#8217;</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.ResponseCacheControl.s_maxage">
<code class="descname">s_maxage</code><a class="headerlink" href="#werkzeug.datastructures.ResponseCacheControl.s_maxage" title="Permalink to this definition"></a></dt>
<dd><p>accessor for &#8216;s-maxage&#8217;</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="werkzeug.datastructures.ETags">
<em class="property">class </em><code class="descclassname">werkzeug.datastructures.</code><code class="descname">ETags</code><span class="sig-paren">(</span><em>strong_etags=None</em>, <em>weak_etags=None</em>, <em>star_tag=False</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.ETags" title="Permalink to this definition"></a></dt>
<dd><p>A set that can be used to check if one etag is present in a collection
of etags.</p>
<dl class="method">
<dt id="werkzeug.datastructures.ETags.as_set">
<code class="descname">as_set</code><span class="sig-paren">(</span><em>include_weak=False</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.ETags.as_set" title="Permalink to this definition"></a></dt>
<dd><p>Convert the <cite>ETags</cite> object into a python set.  Per default all the
weak etags are not part of this set.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.ETags.contains">
<code class="descname">contains</code><span class="sig-paren">(</span><em>etag</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.ETags.contains" title="Permalink to this definition"></a></dt>
<dd><p>Check if an etag is part of the set ignoring weak tags.
It is also possible to use the <code class="docutils literal"><span class="pre">in</span></code> operator.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.ETags.contains_raw">
<code class="descname">contains_raw</code><span class="sig-paren">(</span><em>etag</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.ETags.contains_raw" title="Permalink to this definition"></a></dt>
<dd><p>When passed a quoted tag it will check if this tag is part of the
set.  If the tag is weak it is checked against weak and strong tags,
otherwise strong only.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.ETags.contains_weak">
<code class="descname">contains_weak</code><span class="sig-paren">(</span><em>etag</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.ETags.contains_weak" title="Permalink to this definition"></a></dt>
<dd><p>Check if an etag is part of the set including weak and strong tags.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.ETags.is_weak">
<code class="descname">is_weak</code><span class="sig-paren">(</span><em>etag</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.ETags.is_weak" title="Permalink to this definition"></a></dt>
<dd><p>Check if an etag is weak.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.ETags.to_header">
<code class="descname">to_header</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.ETags.to_header" title="Permalink to this definition"></a></dt>
<dd><p>Convert the etags set into a HTTP header string.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="werkzeug.datastructures.Authorization">
<em class="property">class </em><code class="descclassname">werkzeug.datastructures.</code><code class="descname">Authorization</code><span class="sig-paren">(</span><em>auth_type</em>, <em>data=None</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.Authorization" title="Permalink to this definition"></a></dt>
<dd><p>Represents an <cite>Authorization</cite> header sent by the client.  You should
not create this kind of object yourself but use it when it&#8217;s returned by
the <cite>parse_authorization_header</cite> function.</p>
<p>This object is a dict subclass and can be altered by setting dict items
but it should be considered immutable as it&#8217;s returned by the client and
not meant for modifications.</p>
<div class="versionchanged">
<p><span class="versionmodified">Changed in version 0.5: </span>This object became immutable.</p>
</div>
<dl class="attribute">
<dt id="werkzeug.datastructures.Authorization.cnonce">
<code class="descname">cnonce</code><a class="headerlink" href="#werkzeug.datastructures.Authorization.cnonce" title="Permalink to this definition"></a></dt>
<dd><p>If the server sent a qop-header in the <code class="docutils literal"><span class="pre">WWW-Authenticate</span></code>
header, the client has to provide this value for HTTP digest auth.
See the RFC for more details.</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.Authorization.nc">
<code class="descname">nc</code><a class="headerlink" href="#werkzeug.datastructures.Authorization.nc" title="Permalink to this definition"></a></dt>
<dd><p>The nonce count value transmitted by clients if a qop-header is
also transmitted.  HTTP digest auth only.</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.Authorization.nonce">
<code class="descname">nonce</code><a class="headerlink" href="#werkzeug.datastructures.Authorization.nonce" title="Permalink to this definition"></a></dt>
<dd><p>The nonce the server sent for digest auth, sent back by the client.
A nonce should be unique for every 401 response for HTTP digest
auth.</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.Authorization.opaque">
<code class="descname">opaque</code><a class="headerlink" href="#werkzeug.datastructures.Authorization.opaque" title="Permalink to this definition"></a></dt>
<dd><p>The opaque header from the server returned unchanged by the client.
It is recommended that this string be base64 or hexadecimal data.
Digest auth only.</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.Authorization.password">
<code class="descname">password</code><a class="headerlink" href="#werkzeug.datastructures.Authorization.password" title="Permalink to this definition"></a></dt>
<dd><p>When the authentication type is basic this is the password
transmitted by the client, else <cite>None</cite>.</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.Authorization.qop">
<code class="descname">qop</code><a class="headerlink" href="#werkzeug.datastructures.Authorization.qop" title="Permalink to this definition"></a></dt>
<dd><p>Indicates what &#8220;quality of protection&#8221; the client has applied to
the message for HTTP digest auth.</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.Authorization.realm">
<code class="descname">realm</code><a class="headerlink" href="#werkzeug.datastructures.Authorization.realm" title="Permalink to this definition"></a></dt>
<dd><p>This is the server realm sent back for HTTP digest auth.</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.Authorization.response">
<code class="descname">response</code><a class="headerlink" href="#werkzeug.datastructures.Authorization.response" title="Permalink to this definition"></a></dt>
<dd><p>A string of 32 hex digits computed as defined in RFC 2617, which
proves that the user knows a password.  Digest auth only.</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.Authorization.uri">
<code class="descname">uri</code><a class="headerlink" href="#werkzeug.datastructures.Authorization.uri" title="Permalink to this definition"></a></dt>
<dd><p>The URI from Request-URI of the Request-Line; duplicated because
proxies are allowed to change the Request-Line in transit.  HTTP
digest auth only.</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.Authorization.username">
<code class="descname">username</code><a class="headerlink" href="#werkzeug.datastructures.Authorization.username" title="Permalink to this definition"></a></dt>
<dd><p>The username transmitted.  This is set for both basic and digest
auth all the time.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="werkzeug.datastructures.WWWAuthenticate">
<em class="property">class </em><code class="descclassname">werkzeug.datastructures.</code><code class="descname">WWWAuthenticate</code><span class="sig-paren">(</span><em>auth_type=None</em>, <em>values=None</em>, <em>on_update=None</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.WWWAuthenticate" title="Permalink to this definition"></a></dt>
<dd><p>Provides simple access to <cite>WWW-Authenticate</cite> headers.</p>
<dl class="attribute">
<dt id="werkzeug.datastructures.WWWAuthenticate.algorithm">
<code class="descname">algorithm</code><a class="headerlink" href="#werkzeug.datastructures.WWWAuthenticate.algorithm" title="Permalink to this definition"></a></dt>
<dd><p>A string indicating a pair of algorithms used to produce the digest
and a checksum.  If this is not present it is assumed to be &#8220;MD5&#8221;.
If the algorithm is not understood, the challenge should be ignored
(and a different one used, if there is more than one).</p>
</dd></dl>

<dl class="staticmethod">
<dt id="werkzeug.datastructures.WWWAuthenticate.auth_property">
<em class="property">static </em><code class="descname">auth_property</code><span class="sig-paren">(</span><em>name</em>, <em>doc=None</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.WWWAuthenticate.auth_property" title="Permalink to this definition"></a></dt>
<dd><p>A static helper function for subclasses to add extra authentication
system properties onto a class:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="k">class</span> <span class="nc">FooAuthenticate</span><span class="p">(</span><span class="n">WWWAuthenticate</span><span class="p">):</span>
    <span class="n">special_realm</span> <span class="o">=</span> <span class="n">auth_property</span><span class="p">(</span><span class="s1">&#39;special_realm&#39;</span><span class="p">)</span>
</pre></div>
</div>
<p>For more information have a look at the sourcecode to see how the
regular properties (<a class="reference internal" href="#werkzeug.datastructures.WWWAuthenticate.realm" title="werkzeug.datastructures.WWWAuthenticate.realm"><code class="xref py py-attr docutils literal"><span class="pre">realm</span></code></a> etc.) are implemented.</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.WWWAuthenticate.domain">
<code class="descname">domain</code><a class="headerlink" href="#werkzeug.datastructures.WWWAuthenticate.domain" title="Permalink to this definition"></a></dt>
<dd><p>A list of URIs that define the protection space.  If a URI is an
absolute path, it is relative to the canonical root URL of the
server being accessed.</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.WWWAuthenticate.nonce">
<code class="descname">nonce</code><a class="headerlink" href="#werkzeug.datastructures.WWWAuthenticate.nonce" title="Permalink to this definition"></a></dt>
<dd><p>A server-specified data string which should be uniquely generated
each time a 401 response is made.  It is recommended that this
string be base64 or hexadecimal data.</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.WWWAuthenticate.opaque">
<code class="descname">opaque</code><a class="headerlink" href="#werkzeug.datastructures.WWWAuthenticate.opaque" title="Permalink to this definition"></a></dt>
<dd><p>A string of data, specified by the server, which should be returned
by the client unchanged in the Authorization header of subsequent
requests with URIs in the same protection space.  It is recommended
that this string be base64 or hexadecimal data.</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.WWWAuthenticate.qop">
<code class="descname">qop</code><a class="headerlink" href="#werkzeug.datastructures.WWWAuthenticate.qop" title="Permalink to this definition"></a></dt>
<dd><p>A set of quality-of-privacy directives such as auth and auth-int.</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.WWWAuthenticate.realm">
<code class="descname">realm</code><a class="headerlink" href="#werkzeug.datastructures.WWWAuthenticate.realm" title="Permalink to this definition"></a></dt>
<dd><p>A string to be displayed to users so they know which username and
password to use.  This string should contain at least the name of
the host performing the authentication and might additionally
indicate the collection of users who might have access.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.WWWAuthenticate.set_basic">
<code class="descname">set_basic</code><span class="sig-paren">(</span><em>realm='authentication required'</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.WWWAuthenticate.set_basic" title="Permalink to this definition"></a></dt>
<dd><p>Clear the auth info and enable basic auth.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.WWWAuthenticate.set_digest">
<code class="descname">set_digest</code><span class="sig-paren">(</span><em>realm</em>, <em>nonce</em>, <em>qop=('auth'</em>, <em>)</em>, <em>opaque=None</em>, <em>algorithm=None</em>, <em>stale=False</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.WWWAuthenticate.set_digest" title="Permalink to this definition"></a></dt>
<dd><p>Clear the auth info and enable digest auth.</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.WWWAuthenticate.stale">
<code class="descname">stale</code><a class="headerlink" href="#werkzeug.datastructures.WWWAuthenticate.stale" title="Permalink to this definition"></a></dt>
<dd><p>A flag, indicating that the previous request from the client was
rejected because the nonce value was stale.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.WWWAuthenticate.to_header">
<code class="descname">to_header</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.WWWAuthenticate.to_header" title="Permalink to this definition"></a></dt>
<dd><p>Convert the stored values into a WWW-Authenticate header.</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.WWWAuthenticate.type">
<code class="descname">type</code><a class="headerlink" href="#werkzeug.datastructures.WWWAuthenticate.type" title="Permalink to this definition"></a></dt>
<dd><p>The type of the auth mechanism.  HTTP currently specifies
<cite>Basic</cite> and <cite>Digest</cite>.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="werkzeug.datastructures.IfRange">
<em class="property">class </em><code class="descclassname">werkzeug.datastructures.</code><code class="descname">IfRange</code><span class="sig-paren">(</span><em>etag=None</em>, <em>date=None</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.IfRange" title="Permalink to this definition"></a></dt>
<dd><p>Very simple object that represents the <cite>If-Range</cite> header in parsed
form.  It will either have neither a etag or date or one of either but
never both.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.7.</span></p>
</div>
<dl class="attribute">
<dt id="werkzeug.datastructures.IfRange.date">
<code class="descname">date</code><em class="property"> = None</em><a class="headerlink" href="#werkzeug.datastructures.IfRange.date" title="Permalink to this definition"></a></dt>
<dd><p>The date in parsed format or <cite>None</cite>.</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.IfRange.etag">
<code class="descname">etag</code><em class="property"> = None</em><a class="headerlink" href="#werkzeug.datastructures.IfRange.etag" title="Permalink to this definition"></a></dt>
<dd><p>The etag parsed and unquoted.  Ranges always operate on strong
etags so the weakness information is not necessary.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.IfRange.to_header">
<code class="descname">to_header</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.IfRange.to_header" title="Permalink to this definition"></a></dt>
<dd><p>Converts the object back into an HTTP header.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="werkzeug.datastructures.Range">
<em class="property">class </em><code class="descclassname">werkzeug.datastructures.</code><code class="descname">Range</code><span class="sig-paren">(</span><em>units</em>, <em>ranges</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.Range" title="Permalink to this definition"></a></dt>
<dd><p>Represents a range header.  All the methods are only supporting bytes
as unit.  It does store multiple ranges but <a class="reference internal" href="#werkzeug.datastructures.Range.range_for_length" title="werkzeug.datastructures.Range.range_for_length"><code class="xref py py-meth docutils literal"><span class="pre">range_for_length()</span></code></a> will
only work if only one range is provided.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.7.</span></p>
</div>
<dl class="method">
<dt id="werkzeug.datastructures.Range.make_content_range">
<code class="descname">make_content_range</code><span class="sig-paren">(</span><em>length</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.Range.make_content_range" title="Permalink to this definition"></a></dt>
<dd><p>Creates a <a class="reference internal" href="#werkzeug.datastructures.ContentRange" title="werkzeug.datastructures.ContentRange"><code class="xref py py-class docutils literal"><span class="pre">ContentRange</span></code></a> object
from the current range and given content length.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.Range.range_for_length">
<code class="descname">range_for_length</code><span class="sig-paren">(</span><em>length</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.Range.range_for_length" title="Permalink to this definition"></a></dt>
<dd><p>If the range is for bytes, the length is not None and there is
exactly one range and it is satisfiable it returns a <code class="docutils literal"><span class="pre">(start,</span> <span class="pre">stop)</span></code>
tuple, otherwise <cite>None</cite>.</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.Range.ranges">
<code class="descname">ranges</code><em class="property"> = None</em><a class="headerlink" href="#werkzeug.datastructures.Range.ranges" title="Permalink to this definition"></a></dt>
<dd><p>A list of <code class="docutils literal"><span class="pre">(begin,</span> <span class="pre">end)</span></code> tuples for the range header provided.
The ranges are non-inclusive.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.Range.to_header">
<code class="descname">to_header</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.Range.to_header" title="Permalink to this definition"></a></dt>
<dd><p>Converts the object back into an HTTP header.</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.Range.units">
<code class="descname">units</code><em class="property"> = None</em><a class="headerlink" href="#werkzeug.datastructures.Range.units" title="Permalink to this definition"></a></dt>
<dd><p>The units of this range.  Usually &#8220;bytes&#8221;.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="werkzeug.datastructures.ContentRange">
<em class="property">class </em><code class="descclassname">werkzeug.datastructures.</code><code class="descname">ContentRange</code><span class="sig-paren">(</span><em>units</em>, <em>start</em>, <em>stop</em>, <em>length=None</em>, <em>on_update=None</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.ContentRange" title="Permalink to this definition"></a></dt>
<dd><p>Represents the content range header.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.7.</span></p>
</div>
<dl class="attribute">
<dt id="werkzeug.datastructures.ContentRange.length">
<code class="descname">length</code><a class="headerlink" href="#werkzeug.datastructures.ContentRange.length" title="Permalink to this definition"></a></dt>
<dd><p>The length of the range or <cite>None</cite>.</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.ContentRange.set">
<code class="descname">set</code><span class="sig-paren">(</span><em>start</em>, <em>stop</em>, <em>length=None</em>, <em>units='bytes'</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.ContentRange.set" title="Permalink to this definition"></a></dt>
<dd><p>Simple method to update the ranges.</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.ContentRange.start">
<code class="descname">start</code><a class="headerlink" href="#werkzeug.datastructures.ContentRange.start" title="Permalink to this definition"></a></dt>
<dd><p>The start point of the range or <cite>None</cite>.</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.ContentRange.stop">
<code class="descname">stop</code><a class="headerlink" href="#werkzeug.datastructures.ContentRange.stop" title="Permalink to this definition"></a></dt>
<dd><p>The stop point of the range (non-inclusive) or <cite>None</cite>.  Can only be
<cite>None</cite> if also start is <cite>None</cite>.</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.ContentRange.units">
<code class="descname">units</code><a class="headerlink" href="#werkzeug.datastructures.ContentRange.units" title="Permalink to this definition"></a></dt>
<dd><p>The units to use, usually &#8220;bytes&#8221;</p>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.ContentRange.unset">
<code class="descname">unset</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.ContentRange.unset" title="Permalink to this definition"></a></dt>
<dd><p>Sets the units to <cite>None</cite> which indicates that the header should
no longer be used.</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="others">
<h2>Others<a class="headerlink" href="#others" title="Permalink to this headline"></a></h2>
<dl class="class">
<dt id="werkzeug.datastructures.FileStorage">
<em class="property">class </em><code class="descclassname">werkzeug.datastructures.</code><code class="descname">FileStorage</code><span class="sig-paren">(</span><em>stream=None</em>, <em>filename=None</em>, <em>name=None</em>, <em>content_type=None</em>, <em>content_length=None</em>, <em>headers=None</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.FileStorage" title="Permalink to this definition"></a></dt>
<dd><p>The <a class="reference internal" href="#werkzeug.datastructures.FileStorage" title="werkzeug.datastructures.FileStorage"><code class="xref py py-class docutils literal"><span class="pre">FileStorage</span></code></a> class is a thin wrapper over incoming files.
It is used by the request object to represent uploaded files.  All the
attributes of the wrapper stream are proxied by the file storage so
it&#8217;s possible to do <code class="docutils literal"><span class="pre">storage.read()</span></code> instead of the long form
<code class="docutils literal"><span class="pre">storage.stream.read()</span></code>.</p>
<dl class="attribute">
<dt id="werkzeug.datastructures.FileStorage.stream">
<code class="descname">stream</code><a class="headerlink" href="#werkzeug.datastructures.FileStorage.stream" title="Permalink to this definition"></a></dt>
<dd><p>The input stream for the uploaded file.  This usually points to an
open temporary file.</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.FileStorage.filename">
<code class="descname">filename</code><a class="headerlink" href="#werkzeug.datastructures.FileStorage.filename" title="Permalink to this definition"></a></dt>
<dd><p>The filename of the file on the client.</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.FileStorage.name">
<code class="descname">name</code><a class="headerlink" href="#werkzeug.datastructures.FileStorage.name" title="Permalink to this definition"></a></dt>
<dd><p>The name of the form field.</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.FileStorage.headers">
<code class="descname">headers</code><a class="headerlink" href="#werkzeug.datastructures.FileStorage.headers" title="Permalink to this definition"></a></dt>
<dd><p>The multipart headers as <a class="reference internal" href="#werkzeug.datastructures.Headers" title="werkzeug.datastructures.Headers"><code class="xref py py-class docutils literal"><span class="pre">Headers</span></code></a> object.  This usually contains
irrelevant information but in combination with custom multipart requests
the raw headers might be interesting.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.6.</span></p>
</div>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.FileStorage.close">
<code class="descname">close</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.FileStorage.close" title="Permalink to this definition"></a></dt>
<dd><p>Close the underlying file if possible.</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.FileStorage.content_length">
<code class="descname">content_length</code><a class="headerlink" href="#werkzeug.datastructures.FileStorage.content_length" title="Permalink to this definition"></a></dt>
<dd><p>The content-length sent in the header.  Usually not available</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.FileStorage.content_type">
<code class="descname">content_type</code><a class="headerlink" href="#werkzeug.datastructures.FileStorage.content_type" title="Permalink to this definition"></a></dt>
<dd><p>The content-type sent in the header.  Usually not available</p>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.FileStorage.mimetype">
<code class="descname">mimetype</code><a class="headerlink" href="#werkzeug.datastructures.FileStorage.mimetype" title="Permalink to this definition"></a></dt>
<dd><p>Like <a class="reference internal" href="#werkzeug.datastructures.FileStorage.content_type" title="werkzeug.datastructures.FileStorage.content_type"><code class="xref py py-attr docutils literal"><span class="pre">content_type</span></code></a> but without parameters (eg, without
charset, type etc.).  For example if the content
type is <code class="docutils literal"><span class="pre">text/html;</span> <span class="pre">charset=utf-8</span></code> the mimetype would be
<code class="docutils literal"><span class="pre">'text/html'</span></code>.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.7.</span></p>
</div>
</dd></dl>

<dl class="attribute">
<dt id="werkzeug.datastructures.FileStorage.mimetype_params">
<code class="descname">mimetype_params</code><a class="headerlink" href="#werkzeug.datastructures.FileStorage.mimetype_params" title="Permalink to this definition"></a></dt>
<dd><p>The mimetype parameters as dict.  For example if the content
type is <code class="docutils literal"><span class="pre">text/html;</span> <span class="pre">charset=utf-8</span></code> the params would be
<code class="docutils literal"><span class="pre">{'charset':</span> <span class="pre">'utf-8'}</span></code>.</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 0.7.</span></p>
</div>
</dd></dl>

<dl class="method">
<dt id="werkzeug.datastructures.FileStorage.save">
<code class="descname">save</code><span class="sig-paren">(</span><em>dst</em>, <em>buffer_size=16384</em><span class="sig-paren">)</span><a class="headerlink" href="#werkzeug.datastructures.FileStorage.save" title="Permalink to this definition"></a></dt>
<dd><p>Save the file to a destination path or file object.  If the
destination is a file object you have to close it yourself after the
call.  The buffer size is the number of bytes held in memory during
the copy process.  It defaults to 16KB.</p>
<p>For secure file saving also have a look at <code class="xref py py-func docutils literal"><span class="pre">secure_filename()</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"><ul class="first last simple">
<li><strong>dst</strong> &#8211; a filename or open file object the uploaded file
is saved to.</li>
<li><strong>buffer_size</strong> &#8211; the size of the buffer.  This works the same as
the <cite>length</cite> parameter of
<code class="xref py py-func docutils literal"><span class="pre">shutil.copyfileobj()</span></code>.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

</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/werkzeug.png" alt="Logo"/>
</a></p>
  <h3><a href="index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Data Structures</a><ul>
<li><a class="reference internal" href="#general-purpose">General Purpose</a></li>
<li><a class="reference internal" href="#http-related">HTTP Related</a></li>
<li><a class="reference internal" href="#others">Others</a></li>
</ul>
</li>
</ul>
<h3>Related Topics</h3>
<ul>
  <li><a href="index.html">Documentation overview</a><ul>
      <li>Previous: <a href="http.html" title="previous chapter">HTTP Utilities</a></li>
      <li>Next: <a href="utils.html" title="next chapter">Utilities</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/datastructures.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>