



HTTPStream — HTTPStream 1.1.0 documentation

### Navigation

* [index](genindex/ "General Index")

* [HTTPStream 1.1.0 documentation](#) »

HTTPStream[¶](#httpstream "Permalink to this headline")

=======================================================

HTTPStream is a simple and pragmatic HTTP client library for Python that

provides support for incremental JSON document retrieval and RFC 6570 URI

Templates.

Resources[¶](#resources "Permalink to this headline")

-----------------------------------------------------

A resource is an entity that exists on a distributed system, such as the World

Wide Web, and is identified by a URI. Commonly associated with the REST

architectural style, web resources are objects upon which HTTP methods like

GET and POST can be actioned.

HTTPStream is built around a core [Resource](#httpstream.Resource "httpstream.Resource")

class that embodies the concept of the web resource and instances can be

constructed by simply using the URI by which they are uniquely identified:

```

>>> from httpstream import Resource

>>> resource = Resource("http://example.com/foo/bar")

```

Although the Resource class can be used directly, applications may

alternatively either inherit from or wrap this class to provide more meaningful

naming:

```

from httpstream import Resource

class InheritedMailbox(Resource):

    def \_\_init\_\_(self, uri):

        Resource.\_\_init\_\_(self, uri)

    def deliver(self, message):

        self.post(message)

class WrappedMailbox(object):

    def \_\_init\_\_(self, uri):

        self.\_resource = Resource(uri)

    def deliver(self, message):

        self.\_resource.post(message)

```

For simple HTTP access, resources can of course be created and used in an

immediate inline context:

```

>>> from httpstream import Resource

>>> results = Resource("https://api.duckduckgo.com/?q=neo4j&format=json").get().content

```

Methods such as [get](#httpstream.Resource.get "httpstream.Resource.get") return a

file-like [Response](#httpstream.Response "httpstream.Response") object. The response

content can be either iterated through or retrieved at once:

```

resource = Resource("http://example.com/")

# print each line of the response in turn

with resource.get() as response:

    for line in response:

        print line

# print the entire response content at once

with resource.get() as response:

    print response.content

```

*class* httpstream.Resource(*uri*)[¶](#httpstream.Resource "Permalink to this definition")

A web resource identified by a URI.

get(*headers=None*, *redirect\_limit=5*, *\*\*kwargs*)[¶](#httpstream.Resource.get "Permalink to this definition")

Issue a GET request to this resource.

| Parameters: | * **headers** (*dict*) – headers to be included in the request (optional)

* **redirect\_limit** – maximum number of redirects to be handled

automatically (optional, default=5)

* **product** – name or (name, version) tuple for the client product to

be listed in the User-Agent header (optional)

* **chunk\_size** – number of bytes to retrieve per chunk (optional,

default=4096)

 |

| Returns: | file-like Response

object from which content can be read |

put(*body=None*, *headers=None*, *\*\*kwargs*)[¶](#httpstream.Resource.put "Permalink to this definition")

Issue a PUT request to this resource.

post(*body=None*, *headers=None*, *\*\*kwargs*)[¶](#httpstream.Resource.post "Permalink to this definition")

Issue a POST request to this resource.

delete(*headers=None*, *\*\*kwargs*)[¶](#httpstream.Resource.delete "Permalink to this definition")

Issue a DELETE request to this resource.

head(*headers=None*, *redirect\_limit=5*, *\*\*kwargs*)[¶](#httpstream.Resource.head "Permalink to this definition")

Issue a HEAD request to this resource.

resolve(*reference*, *strict=True*)[¶](#httpstream.Resource.resolve "Permalink to this definition")

Resolve a URI reference against the URI for this resource,

returning a new resource represented by the new target URI.

Implicit Resources[¶](#implicit-resources "Permalink to this headline")

-----------------------------------------------------------------------

A shorthand is also available for implicit resource creation:

```

>>> from httpstream import get

>>> results = get("https://api.duckduckgo.com/?q=neo4j&format=json").content

```

httpstream.get(*uri*, *headers=None*, *redirect\_limit=5*, *\*\*kwargs*)[¶](#httpstream.get "Permalink to this definition")

httpstream.put(*uri*, *body=None*, *headers=None*, *\*\*kwargs*)[¶](#httpstream.put "Permalink to this definition")

httpstream.post(*uri*, *body=None*, *headers=None*, *\*\*kwargs*)[¶](#httpstream.post "Permalink to this definition")

httpstream.delete(*uri*, *headers=None*, *\*\*kwargs*)[¶](#httpstream.delete "Permalink to this definition")

httpstream.head(*uri*, *headers=None*, *redirect\_limit=5*, *\*\*kwargs*)[¶](#httpstream.head "Permalink to this definition")

Resource Templates[¶](#resource-templates "Permalink to this headline")

-----------------------------------------------------------------------

```

>>> from httpstream import ResourceTemplate

>>> searcher = ResourceTemplate("https://api.duckduckgo.com/?q={query}&format=json")

>>> results = searcher.expand(query="neo4j").get().content

```

*class* httpstream.ResourceTemplate(*uri\_template*)[¶](#httpstream.ResourceTemplate "Permalink to this definition")

expand(*\*\*values*)[¶](#httpstream.ResourceTemplate.expand "Permalink to this definition")

Expand this template into a full URI using the values provided.

uri\_template[¶](#httpstream.ResourceTemplate.uri_template "Permalink to this definition")

The URI template string of this resource template.

Requests & Responses[¶](#requests-responses "Permalink to this headline")

-------------------------------------------------------------------------

HTTPStream defines four types of response objects. A standard Response is

generated on receipt of a 2xx status code and a ClientError and

ServerError may be raised on receipt of 4xx and 5xx statuses respectively.

The fourth response type is Redirection which is generally consumed

internally but may also be returned under certain circumstances.

Response objects are file-like and as such may be read or iterated through

The iter\_lines and iter\_json methods may be used to step through

known types of content. The response object itself may also be iterated

directly and an appropriate type of iterator is selected depending on the

type of content available. The example below shows how to print each line of

textual content as it is received:

```

>>> for line in res.get():

...     print line

```

*class* httpstream.Request(*method*, *uri*, *body=None*, *headers=None*)[¶](#httpstream.Request "Permalink to this definition")

body[¶](#httpstream.Request.body "Permalink to this definition")

Content of the request.

headers[¶](#httpstream.Request.headers "Permalink to this definition")

Dictionary of headers attached to the request.

method *= None*[¶](#httpstream.Request.method "Permalink to this definition")

HTTP method of this request

submit(*redirect\_limit=0*, *product=None*, *\*\*response\_kwargs*)[¶](#httpstream.Request.submit "Permalink to this definition")

Submit this request and return a

[Response](#httpstream.Response "httpstream.Response") object.

uri[¶](#httpstream.Request.uri "Permalink to this definition")

URI of the request.

*class* httpstream.Response(*http*, *uri*, *request*, *response*, *\*\*kwargs*)[¶](#httpstream.Response "Permalink to this definition")

File-like object allowing consumption of an HTTP response.

chunk\_size *= None*[¶](#httpstream.Response.chunk_size "Permalink to this definition")

Default chunk size for this response

close()[¶](#httpstream.Response.close "Permalink to this definition")

Close the response, discarding all remaining content and releasing

the underlying connection object.

closed[¶](#httpstream.Response.closed "Permalink to this definition")

Indicates whether or not the response is closed.

content[¶](#httpstream.Response.content "Permalink to this definition")

Fetch all content, returning a value appropriate for the content

type.

content\_length[¶](#httpstream.Response.content_length "Permalink to this definition")

The length of content as provided by the Content-Length header

field. If the content is chunked, this returns None.

content\_type[¶](#httpstream.Response.content_type "Permalink to this definition")

The type of content as provided by the Content-Type header field.

encoding[¶](#httpstream.Response.encoding "Permalink to this definition")

The content character set encoding.

headers[¶](#httpstream.Response.headers "Permalink to this definition")

The response headers.

is\_chunked[¶](#httpstream.Response.is_chunked "Permalink to this definition")

Indicates whether or not the content is chunked.

is\_json[¶](#httpstream.Response.is_json "Permalink to this definition")

Indicates whether or not the content is JSON.

is\_text[¶](#httpstream.Response.is_text "Permalink to this definition")

Indicates whether or not the content is text.

is\_tsj[¶](#httpstream.Response.is_tsj "Permalink to this definition")

Indicates whether or not the content is tab-separated JSON.

iter\_chunks(*chunk\_size=None*)[¶](#httpstream.Response.iter_chunks "Permalink to this definition")

Iterate through the content as chunks of text. Chunk sizes may vary

slightly from that specified due to multi-byte characters. If no chunk

size is specified, a default of 4096 is used.

iter\_json()[¶](#httpstream.Response.iter_json "Permalink to this definition")

Iterate through the content as individual JSON values.

iter\_lines(*keep\_ends=False*)[¶](#httpstream.Response.iter_lines "Permalink to this definition")

Iterate through the content as lines of text.

iter\_tsj()[¶](#httpstream.Response.iter_tsj "Permalink to this definition")

Iterate through the content as lines of tab-separated JSON.

json[¶](#httpstream.Response.json "Permalink to this definition")

Fetch all content, decoding from JSON and returning the decoded

value.

read(*size=None*)[¶](#httpstream.Response.read "Permalink to this definition")

Fetch some or all of the response content, returning as a bytearray.

reason[¶](#httpstream.Response.reason "Permalink to this definition")

The reason phrase attached to this response.

request[¶](#httpstream.Response.request "Permalink to this definition")

The Request object which preceded this response.

status\_code[¶](#httpstream.Response.status_code "Permalink to this definition")

The status code of the response

text[¶](#httpstream.Response.text "Permalink to this definition")

Fetches all content as a string.

tsj[¶](#httpstream.Response.tsj "Permalink to this definition")

Fetches all content, decoding from tab-separated JSON and returning

the decoded values.

uri[¶](#httpstream.Response.uri "Permalink to this definition")

The URI from which the response came.

*class* httpstream.Redirection(*http*, *uri*, *request*, *response*, *\*\*kwargs*)[¶](#httpstream.Redirection "Permalink to this definition")

Bases: httpstream.http.Response

*class* httpstream.ClientError(*http*, *uri*, *request*, *response*, *\*\*kwargs*)[¶](#httpstream.ClientError "Permalink to this definition")

Bases: exceptions.Exception, httpstream.http.Response

*class* httpstream.ServerError(*http*, *uri*, *request*, *response*, *\*\*kwargs*)[¶](#httpstream.ServerError "Permalink to this definition")

Bases: exceptions.Exception, httpstream.http.Response

Incremental JSON Parsing[¶](#incremental-json-parsing "Permalink to this headline")

-----------------------------------------------------------------------------------

*class* httpstream.JSONStream(*source*)[¶](#httpstream.JSONStream "Permalink to this definition")

Streaming JSON decoder. This class both expects Unicode input and will

produce Unicode output.

httpstream.assembled(*iterable*)[¶](#httpstream.assembled "Permalink to this definition")

Returns a JSON-derived value from a set of key-value pairs as produced

by the JSONStream process. This operates in a similar way to the built-in

dict function. Internally, this uses the merged function on each pair

to build the return value.

```

>>> data = [

...     (("drink",), "lemonade"),

...     (("cutlery", 0), "knife"),

...     (("cutlery", 1), "fork"),

...     (("cutlery", 2), "spoon"),

... ]

>>> assembled(data)

{'cutlery': ['knife', 'fork', 'spoon'], 'drink': 'lemonade'}

```

| Parameters: | **iterable** – key-value pairs to be merged into assembled value |

httpstream.grouped(*iterable*, *level=1*)[¶](#httpstream.grouped "Permalink to this definition")

URIs[¶](#uris "Permalink to this headline")

-------------------------------------------

*class* httpstream.URI(*value*)[¶](#httpstream.URI "Permalink to this definition")

Uniform Resource Identifier.

See also

[RFC 3986](http://tools.ietf.org/html/rfc3986)

absolute\_path\_reference[¶](#httpstream.URI.absolute_path_reference "Permalink to this definition")

The path, query and fragment parts of this URI or None

if undefined.

**Component Definition:**

```

https://bob@example.com:8080/data/report.html?date=2000-12-25#summary

                            \_______________________________________/

                                                |

                                      absolute_path_reference

```

| Returns: | combined string values of path, query and fragment parts or

None |

| Return type: | percent-encoded string or None |

authority[¶](#httpstream.URI.authority "Permalink to this definition")

The authority part of this URI or None if undefined.

**Component Definition:**

```

https://bob@example.com:8080/data/report.html?date=2000-12-25#summary

        \__________________/

                 |

             authority

```

| Return type: | Authority instance or

None |

fragment[¶](#httpstream.URI.fragment "Permalink to this definition")

The *fragment* part of this URI or None if undefined.

**Component Definition:**

```

https://bob@example.com:8080/data/report.html?date=2000-12-25#summary

                                                              \_____/

                                                                 |

                                                              fragment

```

| Returns: |  |

| Return type: | unencoded string or None |

hierarchical\_part[¶](#httpstream.URI.hierarchical_part "Permalink to this definition")

The authority and path parts of this URI or None if

undefined.

**Component Definition:**

```

https://bob@example.com:8080/data/report.html?date=2000-12-25#summary

        \___________________________________/

                          |

                  hierarchical_part

```

| Returns: | combined string values of authority and path parts or

None |

| Return type: | percent-encoded string or None |

host[¶](#httpstream.URI.host "Permalink to this definition")

The *host* part of this URI or None if undefined.

```

>>> URI(None).host

None

>>> URI("").host

None

>>> URI("http://example.com").host

'example.com'

>>> URI("http://example.com:8080/data").host

'example.com'

```

**Component Definition:**

```

https://bob@example.com:8080/data/report.html?date=2000-12-25#summary

            \_________/

                 |

                host

```

| Returns: |  |

| Return type: | unencoded string or None |

host\_port[¶](#httpstream.URI.host_port "Permalink to this definition")

The *host* and *port* parts of this URI separated by a colon or

None if both are undefined.

```

>>> URI(None).host\_port

None

>>> URI("").host\_port

None

>>> URI("http://example.com").host\_port

'example.com'

>>> URI("http://example.com:8080/data").host\_port

'example.com:8080'

>>> URI("http://bob@example.com:8080/data").host\_port

'example.com:8080'

```

**Component Definition:**

```

https://bob@example.com:8080/data/report.html?date=2000-12-25#summary

            \______________/

                   |

               host_port

```

| Returns: |  |

| Return type: | percent-encoded string or None |

path[¶](#httpstream.URI.path "Permalink to this definition")

The *path* part of this URI or None if undefined.

**Component Definition:**

```

https://bob@example.com:8080/data/report.html?date=2000-12-25#summary

                            \_______________/

                                    |

                                   path

```

| Returns: |  |

| Return type: | Path instance or

None |

port[¶](#httpstream.URI.port "Permalink to this definition")

The *port* part of this URI or None if undefined.

```

>>> URI(None).port

None

>>> URI("").port

None

>>> URI("http://example.com").port

None

>>> URI("http://example.com:8080/data").port

8080

```

**Component Definition:**

```

https://bob@example.com:8080/data/report.html?date=2000-12-25#summary

                        \__/

                         |

                        port

```

| Returns: |  |

| Return type: | integer or None |

query[¶](#httpstream.URI.query "Permalink to this definition")

The *query* part of this URI or None if undefined.

**Component Definition:**

```

https://bob@example.com:8080/data/report.html?date=2000-12-25#summary

                                              \_____________/

                                                     |

                                                   query

```

| Return type: | Query instance or

None |

resolve(*reference*, *strict=True*)[¶](#httpstream.URI.resolve "Permalink to this definition")

Transform a reference relative to this URI to produce a full target

URI.

See also

[RFC 3986 § 5.2.2](http://tools.ietf.org/html/rfc3986#section-5.2.2)

scheme[¶](#httpstream.URI.scheme "Permalink to this definition")

The scheme part of this URI or None if undefined.

**Component Definition:**

```

https://bob@example.com:8080/data/report.html?date=2000-12-25#summary

\___/

  |

scheme

```

| Return type: | unencoded string or None |

string[¶](#httpstream.URI.string "Permalink to this definition")

The full percent-encoded string value of this URI or

None if undefined.

```

>>> URI(None).string

None

>>> URI("").string

''

>>> URI("http://example.com").string

'example.com'

>>> URI("foo/bar").string

'foo/bar'

>>> URI("http://bob@example.com:8080/data/report.html?date=2000-12-25#summary").string

'http://bob@example.com:8080/data/report.html?date=2000-12-25#summary'

```

**Component Definition:**

```

https://bob@example.com:8080/data/report.html?date=2000-12-25#summary

\___________________________________________________________________/

                                 |

                               string

```

| Return type: | percent-encoded string or None |

Note

Unlike string, the \_\_str\_\_ method will always return a

string, even when the URI is undefined; in this case, an empty

string is returned instead of None.

user\_info[¶](#httpstream.URI.user_info "Permalink to this definition")

The user information part of this URI or None if

undefined.

**Component Definition:**

```

https://bob@example.com:8080/data/report.html?date=2000-12-25#summary

        \_/

         |

     user_info

```

| Returns: | string value of user information part or None |

| Return type: | unencoded string or None |

*class* httpstream.Authority(*string*)[¶](#httpstream.Authority "Permalink to this definition")

A host name plus optional port and user information detail.

**Syntax**

authority := [ user\_info "@" ] host [ ":" port ]

See also

[RFC 3986 § 3.2](http://tools.ietf.org/html/rfc3986#section-3.2)

host[¶](#httpstream.Authority.host "Permalink to this definition")

The host part of this authority component, an empty string if host

is empty or None if undefined.

```

>>> Authority(None).host

None

>>> Authority("").host

''

>>> Authority("example.com").host

'example.com'

>>> Authority("example.com:8080").host

'example.com'

>>> Authority("bob@example.com").host

'example.com'

>>> Authority("bob@example.com:8080").host

'example.com'

```

| Returns: |  |

host\_port[¶](#httpstream.Authority.host_port "Permalink to this definition")

The host and port parts of this authority component or

None if undefined.

```

>>> Authority(None).host\_port

None

>>> Authority("").host\_port

''

>>> Authority("example.com").host\_port

'example.com'

>>> Authority("example.com:8080").host\_port

'example.com:8080'

>>> Authority("bob@example.com").host\_port

'example.com'

>>> Authority("bob@example.com:8080").host\_port

'example.com:8080'

```

| Returns: |  |

port[¶](#httpstream.Authority.port "Permalink to this definition")

The port part of this authority component or None if

undefined.

```

>>> Authority(None).port

None

>>> Authority("").port

None

>>> Authority("example.com").port

None

>>> Authority("example.com:8080").port

8080

>>> Authority("bob@example.com").port

None

>>> Authority("bob@example.com:8080").port

8080

```

| Returns: |  |

string[¶](#httpstream.Authority.string "Permalink to this definition")

The full string value of this authority component or

:py:const:`None if undefined.

```

>>> Authority(None).string

None

>>> Authority("").string

''

>>> Authority("example.com").string

'example.com'

>>> Authority("example.com:8080").string

'example.com:8080'

>>> Authority("bob@example.com").string

'bob@example.com'

>>> Authority("bob@example.com:8080").string

'bob@example.com:8080'

```

| Returns: |  |

user\_info[¶](#httpstream.Authority.user_info "Permalink to this definition")

The user information part of this authority component or

None if undefined.

```

>>> Authority(None).user\_info

None

>>> Authority("").user\_info

None

>>> Authority("example.com").user\_info

None

>>> Authority("example.com:8080").user\_info

None

>>> Authority("bob@example.com").user\_info

'bob'

>>> Authority("bob@example.com:8080").user\_info

'bob'

```

| Returns: |  |

*class* httpstream.Path(*string*)[¶](#httpstream.Path "Permalink to this definition")

remove\_dot\_segments()[¶](#httpstream.Path.remove_dot_segments "Permalink to this definition")

Implementation of RFC3986, section 5.2.4

segments[¶](#httpstream.Path.segments "Permalink to this definition")

string[¶](#httpstream.Path.string "Permalink to this definition")

with\_trailing\_slash()[¶](#httpstream.Path.with_trailing_slash "Permalink to this definition")

without\_trailing\_slash()[¶](#httpstream.Path.without_trailing_slash "Permalink to this definition")

*class* httpstream.Query(*string*)[¶](#httpstream.Query "Permalink to this definition")

*classmethod* decode(*string*)[¶](#httpstream.Query.decode "Permalink to this definition")

*classmethod* encode(*iterable*)[¶](#httpstream.Query.encode "Permalink to this definition")

string[¶](#httpstream.Query.string "Permalink to this definition")

URI Templates[¶](#uri-templates "Permalink to this headline")

-------------------------------------------------------------

*class* httpstream.URITemplate(*template*)[¶](#httpstream.URITemplate "Permalink to this definition")

A URI Template is a compact sequence of characters for describing a

range of Uniform Resource Identifiers through variable expansion.

This class exposes a full implementation of RFC6570.

expand(*\*\*values*)[¶](#httpstream.URITemplate.expand "Permalink to this definition")

Expand into a URI using the values supplied

string[¶](#httpstream.URITemplate.string "Permalink to this definition")

See also

[RFC 6570](http://tools.ietf.org/html/rfc6570)

Percent Encoding[¶](#percent-encoding "Permalink to this headline")

-------------------------------------------------------------------

Percent encoding is used within URI components to allow inclusion of certain

characters which are not within a permitted set.

httpstream.percent\_encode(*data*, *safe=None*)[¶](#httpstream.percent_encode "Permalink to this definition")

Percent encode a string of data, optionally keeping certain characters

unencoded.

httpstream.percent\_decode(*data*)[¶](#httpstream.percent_decode "Permalink to this definition")

Percent decode a string of data.

See also

[RFC 3986 § 2.1](http://tools.ietf.org/html/rfc3986#section-2.1)

Errors[¶](#errors "Permalink to this headline")

-----------------------------------------------

*exception* httpstream.NetworkAddressError(*message*, *host\_port=None*)[¶](#httpstream.NetworkAddressError "Permalink to this definition")

host\_port[¶](#httpstream.NetworkAddressError.host_port "Permalink to this definition")

*exception* httpstream.SocketError(*code*, *host\_port=None*)[¶](#httpstream.SocketError "Permalink to this definition")

code[¶](#httpstream.SocketError.code "Permalink to this definition")

host\_port[¶](#httpstream.SocketError.host_port "Permalink to this definition")

*exception* httpstream.RedirectionError(*\*args*, *\*\*kwargs*)[¶](#httpstream.RedirectionError "Permalink to this definition")

[![Logo](_static/httpstream.190x46.png)](#)

### [Table Of Contents](#)

* [HTTPStream](#)

	+ [Resources](#resources)

	+ [Implicit Resources](#implicit-resources)

	+ [Resource Templates](#resource-templates)

	+ [Requests & Responses](#requests-responses)

	+ [Incremental JSON Parsing](#incremental-json-parsing)

	+ [URIs](#uris)

	+ [URI Templates](#uri-templates)

	+ [Percent Encoding](#percent-encoding)

	+ [Errors](#errors)

### This Page

* [Show Source](_sources/index.txt)

### Quick search

 Enter search terms or a module, class or function name.

 

### Navigation

* [index](genindex/ "General Index")

* [HTTPStream 1.1.0 documentation](#) »

 © Copyright 2013, Nigel Small.

 Created using [Sphinx](http://sphinx.pocoo.org/) 1.1.3.

 





Index — HTTPStream 1.1.0 documentation

### Navigation

* [index](# "General Index")

* [HTTPStream 1.1.0 documentation](../) »

Index

=====

[**A**](#A)

 | [**B**](#B)

 | [**C**](#C)

 | [**D**](#D)

 | [**E**](#E)

 | [**F**](#F)

 | [**G**](#G)

 | [**H**](#H)

 | [**I**](#I)

 | [**J**](#J)

 | [**M**](#M)

 | [**N**](#N)

 | [**P**](#P)

 | [**Q**](#Q)

 | [**R**](#R)

 | [**S**](#S)

 | [**T**](#T)

 | [**U**](#U)

 | [**W**](#W)

A

-

|  |  |

| --- | --- |

| 

[absolute\_path\_reference (httpstream.URI attribute)](../#httpstream.URI.absolute_path_reference)

[assembled() (in module httpstream)](../#httpstream.assembled)

 | 

[Authority (class in httpstream)](../#httpstream.Authority)

[authority (httpstream.URI attribute)](../#httpstream.URI.authority)

 |

B

-

|  |

| --- |

| 

[body (httpstream.Request attribute)](../#httpstream.Request.body)

 |

C

-

|  |  |

| --- | --- |

| 

[chunk\_size (httpstream.Response attribute)](../#httpstream.Response.chunk_size)

[ClientError (class in httpstream)](../#httpstream.ClientError)

[close() (httpstream.Response method)](../#httpstream.Response.close)

[closed (httpstream.Response attribute)](../#httpstream.Response.closed)

 | 

[code (httpstream.SocketError attribute)](../#httpstream.SocketError.code)

[content (httpstream.Response attribute)](../#httpstream.Response.content)

[content\_length (httpstream.Response attribute)](../#httpstream.Response.content_length)

[content\_type (httpstream.Response attribute)](../#httpstream.Response.content_type)

 |

D

-

|  |  |

| --- | --- |

| 

[decode() (httpstream.Query class method)](../#httpstream.Query.decode)

 | 

[delete() (httpstream.Resource method)](../#httpstream.Resource.delete)

[(in module httpstream)](../#httpstream.delete)

 |

E

-

|  |  |

| --- | --- |

| 

[encode() (httpstream.Query class method)](../#httpstream.Query.encode)

[encoding (httpstream.Response attribute)](../#httpstream.Response.encoding)

 | 

[expand() (httpstream.ResourceTemplate method)](../#httpstream.ResourceTemplate.expand)

[(httpstream.URITemplate method)](../#httpstream.URITemplate.expand)

 |

F

-

|  |

| --- |

| 

[fragment (httpstream.URI attribute)](../#httpstream.URI.fragment)

 |

G

-

|  |  |

| --- | --- |

| 

[get() (httpstream.Resource method)](../#httpstream.Resource.get)

[(in module httpstream)](../#httpstream.get)

 | 

[grouped() (in module httpstream)](../#httpstream.grouped)

 |

H

-

|  |  |

| --- | --- |

| 

[head() (httpstream.Resource method)](../#httpstream.Resource.head)

[(in module httpstream)](../#httpstream.head)

[headers (httpstream.Request attribute)](../#httpstream.Request.headers)

[(httpstream.Response attribute)](../#httpstream.Response.headers)

[hierarchical\_part (httpstream.URI attribute)](../#httpstream.URI.hierarchical_part)

 | 

[host (httpstream.Authority attribute)](../#httpstream.Authority.host)

[(httpstream.URI attribute)](../#httpstream.URI.host)

[host\_port (httpstream.Authority attribute)](../#httpstream.Authority.host_port)

[(httpstream.NetworkAddressError attribute)](../#httpstream.NetworkAddressError.host_port)

[(httpstream.SocketError attribute)](../#httpstream.SocketError.host_port)

[(httpstream.URI attribute)](../#httpstream.URI.host_port)

 |

I

-

|  |  |

| --- | --- |

| 

[is\_chunked (httpstream.Response attribute)](../#httpstream.Response.is_chunked)

[is\_json (httpstream.Response attribute)](../#httpstream.Response.is_json)

[is\_text (httpstream.Response attribute)](../#httpstream.Response.is_text)

[is\_tsj (httpstream.Response attribute)](../#httpstream.Response.is_tsj)

 | 

[iter\_chunks() (httpstream.Response method)](../#httpstream.Response.iter_chunks)

[iter\_json() (httpstream.Response method)](../#httpstream.Response.iter_json)

[iter\_lines() (httpstream.Response method)](../#httpstream.Response.iter_lines)

[iter\_tsj() (httpstream.Response method)](../#httpstream.Response.iter_tsj)

 |

J

-

|  |  |

| --- | --- |

| 

[json (httpstream.Response attribute)](../#httpstream.Response.json)

 | 

[JSONStream (class in httpstream)](../#httpstream.JSONStream)

 |

M

-

|  |

| --- |

| 

[method (httpstream.Request attribute)](../#httpstream.Request.method)

 |

N

-

|  |

| --- |

| 

[NetworkAddressError](../#httpstream.NetworkAddressError)

 |

P

-

|  |  |

| --- | --- |

| 

[Path (class in httpstream)](../#httpstream.Path)

[path (httpstream.URI attribute)](../#httpstream.URI.path)

[percent\_decode() (in module httpstream)](../#httpstream.percent_decode)

[percent\_encode() (in module httpstream)](../#httpstream.percent_encode)

 | 

[port (httpstream.Authority attribute)](../#httpstream.Authority.port)

[(httpstream.URI attribute)](../#httpstream.URI.port)

[post() (httpstream.Resource method)](../#httpstream.Resource.post)

[(in module httpstream)](../#httpstream.post)

[put() (httpstream.Resource method)](../#httpstream.Resource.put)

[(in module httpstream)](../#httpstream.put)

 |

Q

-

|  |  |

| --- | --- |

| 

[Query (class in httpstream)](../#httpstream.Query)

 | 

[query (httpstream.URI attribute)](../#httpstream.URI.query)

 |

R

-

|  |  |

| --- | --- |

| 

[read() (httpstream.Response method)](../#httpstream.Response.read)

[reason (httpstream.Response attribute)](../#httpstream.Response.reason)

[Redirection (class in httpstream)](../#httpstream.Redirection)

[RedirectionError](../#httpstream.RedirectionError)

[remove\_dot\_segments() (httpstream.Path method)](../#httpstream.Path.remove_dot_segments)

[Request (class in httpstream)](../#httpstream.Request)

 | 

[request (httpstream.Response attribute)](../#httpstream.Response.request)

[resolve() (httpstream.Resource method)](../#httpstream.Resource.resolve)

[(httpstream.URI method)](../#httpstream.URI.resolve)

[Resource (class in httpstream)](../#httpstream.Resource)

[ResourceTemplate (class in httpstream)](../#httpstream.ResourceTemplate)

[Response (class in httpstream)](../#httpstream.Response)

 |

S

-

|  |  |

| --- | --- |

| 

[scheme (httpstream.URI attribute)](../#httpstream.URI.scheme)

[segments (httpstream.Path attribute)](../#httpstream.Path.segments)

[ServerError (class in httpstream)](../#httpstream.ServerError)

[SocketError](../#httpstream.SocketError)

 | 

[status\_code (httpstream.Response attribute)](../#httpstream.Response.status_code)

[string (httpstream.Authority attribute)](../#httpstream.Authority.string)

[(httpstream.Path attribute)](../#httpstream.Path.string)

[(httpstream.Query attribute)](../#httpstream.Query.string)

[(httpstream.URI attribute)](../#httpstream.URI.string)

[(httpstream.URITemplate attribute)](../#httpstream.URITemplate.string)

[submit() (httpstream.Request method)](../#httpstream.Request.submit)

 |

T

-

|  |  |

| --- | --- |

| 

[text (httpstream.Response attribute)](../#httpstream.Response.text)

 | 

[tsj (httpstream.Response attribute)](../#httpstream.Response.tsj)

 |

U

-

|  |  |

| --- | --- |

| 

[URI (class in httpstream)](../#httpstream.URI)

[uri (httpstream.Request attribute)](../#httpstream.Request.uri)

[(httpstream.Response attribute)](../#httpstream.Response.uri)

[uri\_template (httpstream.ResourceTemplate attribute)](../#httpstream.ResourceTemplate.uri_template)

 | 

[URITemplate (class in httpstream)](../#httpstream.URITemplate)

[user\_info (httpstream.Authority attribute)](../#httpstream.Authority.user_info)

[(httpstream.URI attribute)](../#httpstream.URI.user_info)

 |

W

-

|  |  |

| --- | --- |

| 

[with\_trailing\_slash() (httpstream.Path method)](../#httpstream.Path.with_trailing_slash)

 | 

[without\_trailing\_slash() (httpstream.Path method)](../#httpstream.Path.without_trailing_slash)

 |

[![Logo](../_static/httpstream.190x46.png)](../)

### Quick search

 Enter search terms or a module, class or function name.

 

### Navigation

* [index](# "General Index")

* [HTTPStream 1.1.0 documentation](../) »

 © Copyright 2013, Nigel Small.

 Created using [Sphinx](http://sphinx.pocoo.org/) 1.1.3.

 





Overview: module code — HTTPStream 1.1.0 documentation

### Navigation

* [index](../genindex/ "General Index")

* [HTTPStream 1.1.0 documentation](../) »

All modules for which code is available

=======================================

* [httpstream](httpstream/)

[![Logo](../_static/httpstream.190x46.png)](../)

### Quick search

 Enter search terms or a module, class or function name.

 

### Navigation

* [index](../genindex/ "General Index")

* [HTTPStream 1.1.0 documentation](../) »

 © Copyright 2013, Nigel Small.

 Created using [Sphinx](http://sphinx.pocoo.org/) 1.1.3.

 





httpstream — HTTPStream 1.1.0 documentation

### Navigation

* [index](../../genindex/ "General Index")

* [HTTPStream 1.1.0 documentation](../../) »

* [Module code](../) »

Source code for httpstream

==========================

```

#!/usr/bin/env python

# -\*- coding: utf-8 -\*-

# Copyright 2013, Nigel Small

#

# Licensed under the Apache License, Version 2.0 (the "License");

# you may not use this file except in compliance with the License.

# You may obtain a copy of the License at

#

# http://www.apache.org/licenses/LICENSE-2.0

#

# Unless required by applicable law or agreed to in writing, software

# distributed under the License is distributed on an "AS IS" BASIS,

# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

# See the License for the specific language governing permissions and

# limitations under the License.

"""

HTTPStream

"""

\_\_author\_\_ = "Nigel Small"

\_\_copyright\_\_ = "2013, Nigel Small"

\_\_email\_\_ = "nigel@nigelsmall.com"

\_\_license\_\_ = "Apache License, Version 2.0"

\_\_version\_\_ = "1.1.0"

from .http import \*

from .jsonstream import \*

from .uri import \*

```

[![Logo](../../_static/httpstream.190x46.png)](../../)

### Quick search

 Enter search terms or a module, class or function name.

 

### Navigation

* [index](../../genindex/ "General Index")

* [HTTPStream 1.1.0 documentation](../../) »

* [Module code](../) »

 © Copyright 2013, Nigel Small.

 Created using [Sphinx](http://sphinx.pocoo.org/) 1.1.3.

 





Search — HTTPStream 1.1.0 documentation

### Navigation

* [index](../genindex/ "General Index")

* [HTTPStream 1.1.0 documentation](../) »

Search

======

 Please activate JavaScript to enable the search

 functionality.

 

 From here you can search these documents. Enter your search

 words into the box below and click "search". Note that the search

 function will automatically search for all of the words. Pages

 containing fewer words won't appear in the result list.

 

[![Logo](../_static/httpstream.190x46.png)](../)

### Navigation

* [index](../genindex/ "General Index")

* [HTTPStream 1.1.0 documentation](../) »

 © Copyright 2013, Nigel Small.

 Created using [Sphinx](http://sphinx.pocoo.org/) 1.1.3.

 

