---
product: Chilkat
product_version: 11.7.0
language: ckpython
language_label: CkPython
class: HttpResponse
class_name: CkHttpResponse
license: bundle
deprecated: false
reference_html: https://www.chilkatsoft.com/refdoc/pythonCkHttpResponseRef.html
---
# Chilkat HttpResponse — CkPython — v11.7.0

> Chilkat 11.7.0 · language=ckpython · class=HttpResponse (CkHttpResponse)
> Other versions: replace `11.7.0` in this URL. Other languages: `https://www.chilkatsoft.com/ai-docs/v/11.7.0/<lang>/classes/HttpResponse.md`.
> Language-wide rules (install, unlock, error model, strings/bytes): `https://www.chilkatsoft.com/ai-docs/v/11.7.0/ckpython/guide.md`.

## Purpose

**Inspect HTTP status, headers, cookies, redirects, and response bodies.**

`Chilkat.HttpResponse` represents an HTTP response returned by certain `Chilkat.Http` methods. It provides access to the response status line, status code, headers, cookies, charset, content length, body bytes, body text, full MIME response, redirect URL, and helper methods for saving or loading the response body into Chilkat objects such as `BinData`, `StringBuilder`, `JsonObject`, `JsonArray`, and `Xml`.

**Status and reason**

Read the HTTP status code, status line, and related response information to determine whether the request succeeded, redirected, or failed.

**Headers and cookies**

Inspect response headers, retrieve individual header values, and access cookies returned by the server.

**Body as text or bytes**

Get the response body as raw bytes or decoded text, using the response charset information when appropriate.

**Structured body loading**

Load the body directly into `JsonObject`, `JsonArray`, `Xml`, `BinData`, or `StringBuilder` objects for further processing.

**Redirect information**

Access redirect-related information such as the redirect URL when the server responds with a redirect status.

**Save and inspect responses**

Save body content, inspect the full MIME-style response, and use response metadata for diagnostics, logging, or API troubleshooting.

**Common pattern:** Send a request with `Chilkat.Http`, check the `StatusCode`, inspect headers or cookies as needed, then retrieve the body in the form best suited to the response content: text, bytes, `BinData`, `StringBuilder`, JSON, or XML. Use `HttpResponse` for response inspection; use `Chilkat.Http` for the actual network request.

For an extended overview, see [HttpResponse Class Overview](https://www.chilkatsoft.com/httpresponse_class_overview.asp).

## Object creation, unlocking and error handling

**Object Creation**

```python
obj = chilkat.CkHttpResponse()
```

Call `Global.UnlockBundle` once at the start of the program, before using this or any other Chilkat class. Any string unlocks a fully functional 30-day trial; a purchased unlock code is used in production. See `guide.md` for the exact code in CkPython.

How failure is reported depends on the method's return type and is stated in the note under each method below. In every case the diagnostic text is in the `LastErrorText` property of the object whose method was called.

## Members common to every Chilkat class

Documented once per language in `common-members.md`; listed here so this page is self-contained.

| Property | Signature | Access | Meaning |
|---|---|---|---|
| `DebugLogFilePath` | `# strVal is a string # ckStr is a CkString httpResponse.get_DebugLogFilePath(ckStr); strVal = httpResponse.debugLogFilePath(); httpResponse.put_DebugLogFilePath(strVal);` | read/write | If set to a file path, this property logs the LastErrorText of each Chilkat method or property call to the specified file. |
| `LastErrorHtml` | `# strVal is a string # ckStr is a CkString httpResponse.get_LastErrorHtml(ckStr); strVal = httpResponse.lastErrorHtml();` | read-only | Provides HTML-formatted information about the last called method or property. |
| `LastErrorText` | `# strVal is a string # ckStr is a CkString httpResponse.get_LastErrorText(ckStr); strVal = httpResponse.lastErrorText();` | read-only | Provides plain text information about the last called method or property. |
| `LastErrorXml` | `# strVal is a string # ckStr is a CkString httpResponse.get_LastErrorXml(ckStr); strVal = httpResponse.lastErrorXml();` | read-only | Provides XML-formatted information about the last called method or property. |
| `LastMethodSuccess` | `# boolVal is a boolean boolVal = httpResponse.get_LastMethodSuccess(); httpResponse.put_LastMethodSuccess(boolVal);` | read/write | Indicates the success or failure of the most recent method call: `True` means success, `False` means failure. |
| `Utf8` | `# boolVal is a boolean boolVal = httpResponse.get_Utf8(); httpResponse.put_Utf8(boolVal);` | read/write | When set to `True`, all `string` arguments and return values are interpreted as UTF-8 strings. |
| `VerboseLogging` | `# boolVal is a boolean boolVal = httpResponse.get_VerboseLogging(); httpResponse.put_VerboseLogging(boolVal);` | read/write | If set to `True`, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. |
| `Version` | `# strVal is a string # ckStr is a CkString httpResponse.get_Version(ckStr); strVal = httpResponse.version();` | read-only | Version of the component/library, such as "10.1.0" |

## Member index

| Member | Kind | Signature |
|---|---|---|
| `BodyQP` | property, read-only | `# strVal is a string # ckStr is a CkString httpResponse.get_BodyQP(ckStr); strVal = httpResponse.bodyQP();` |
| `BodyStr` | property, read-only | `# strVal is a string # ckStr is a CkString httpResponse.get_BodyStr(ckStr); strVal = httpResponse.bodyStr();` |
| `Charset` | property, read-only | `# strVal is a string # ckStr is a CkString httpResponse.get_Charset(ckStr); strVal = httpResponse.charset();` |
| `ContentLength` | property, read-only | `# intVal is a unsigned long intVal = httpResponse.get_ContentLength();` |
| `ContentLength64` | property, read-only | `# int64Val is a 64-bit integer int64Val = httpResponse.get_ContentLength64();` |
| `DateStr` | property, read-only | `# strVal is a string # ckStr is a CkString httpResponse.get_DateStr(ckStr); strVal = httpResponse.dateStr();` |
| `Domain` | property, read-only | `# strVal is a string # ckStr is a CkString httpResponse.get_Domain(ckStr); strVal = httpResponse.domain();` |
| `FinalRedirectUrl` | property, read-only | `# strVal is a string # ckStr is a CkString httpResponse.get_FinalRedirectUrl(ckStr); strVal = httpResponse.finalRedirectUrl();` |
| `FullMime` | property, read-only | `# strVal is a string # ckStr is a CkString httpResponse.get_FullMime(ckStr); strVal = httpResponse.fullMime();` |
| `Header` | property, read-only | `# strVal is a string # ckStr is a CkString httpResponse.get_Header(ckStr); strVal = httpResponse.header();` |
| `NumCookies` | property, read-only | `# intVal is an integer intVal = httpResponse.get_NumCookies();` |
| `NumHeaderFields` | property, read-only | `# intVal is an integer intVal = httpResponse.get_NumHeaderFields();` |
| `StatusCode` | property, read-only | `# intVal is an integer intVal = httpResponse.get_StatusCode();` |
| `StatusLine` | property, read-only | `# strVal is a string # ckStr is a CkString httpResponse.get_StatusLine(ckStr); strVal = httpResponse.statusLine();` |
| `StatusText` | property, read-only | `# strVal is a string # ckStr is a CkString httpResponse.get_StatusText(ckStr); strVal = httpResponse.statusText();` |
| `UncommonOptions` | property, read/write | `# strVal is a string # ckStr is a CkString httpResponse.get_UncommonOptions(ckStr); strVal = httpResponse.uncommonOptions(); httpResponse.put_UncommonOptions(strVal);` |
| `GetBodyBd` | method | `# binData is a CkBinData status = httpResponse.GetBodyBd(binData);` |
| `GetBodyJarr` | method | `# jarr is a CkJsonArray status = httpResponse.GetBodyJarr(jarr);` |
| `GetBodyJson` | method | `# json is a CkJsonObject status = httpResponse.GetBodyJson(json);` |
| `GetBodySb` | method | `# sb is a CkStringBuilder status = httpResponse.GetBodySb(sb);` |
| `GetBodyXml` | method | `# xml is a CkXml status = httpResponse.GetBodyXml(xml);` |
| `GetCookieDomain` | method | `# index is an integer # outStr is a CkString (output) status = httpResponse.GetCookieDomain(index, outStr); retStr = httpResponse.getCookieDomain(index);` |
| `GetCookieExpiresStr` | method | `# index is an integer # outStr is a CkString (output) status = httpResponse.GetCookieExpiresStr(index, outStr); retStr = httpResponse.getCookieExpiresStr(index);` |
| `GetCookieName` | method | `# index is an integer # outStr is a CkString (output) status = httpResponse.GetCookieName(index, outStr); retStr = httpResponse.getCookieName(index);` |
| `GetCookiePath` | method | `# index is an integer # outStr is a CkString (output) status = httpResponse.GetCookiePath(index, outStr); retStr = httpResponse.getCookiePath(index);` |
| `GetCookieValue` | method | `# index is an integer # outStr is a CkString (output) status = httpResponse.GetCookieValue(index, outStr); retStr = httpResponse.getCookieValue(index);` |
| `GetHeaderField` | method | `# fieldName is a string # outStr is a CkString (output) status = httpResponse.GetHeaderField(fieldName, outStr); retStr = httpResponse.getHeaderField(fieldName);` |
| `GetHeaderFieldAttr` | method | `# fieldName is a string # attrName is a string # outStr is a CkString (output) status = httpResponse.GetHeaderFieldAttr(fieldName, attrName, outStr); retStr = httpResponse.getHeaderFieldAttr(fieldName, attrName);` |
| `GetHeaderName` | method | `# index is an integer # outStr is a CkString (output) status = httpResponse.GetHeaderName(index, outStr); retStr = httpResponse.getHeaderName(index);` |
| `GetHeaderValue` | method | `# index is an integer # outStr is a CkString (output) status = httpResponse.GetHeaderValue(index, outStr); retStr = httpResponse.getHeaderValue(index);` |
| `LoadTaskResult` | method | `# task is a CkTask status = httpResponse.LoadTaskResult(task);` |
| `SaveBodyBinary` | method | `# path is a string status = httpResponse.SaveBodyBinary(path);` |
| `SaveBodyText` | method | `# bCrlf is a boolean # path is a string status = httpResponse.SaveBodyText(bCrlf, path);` |
| `UrlEncParamValue` | method | `# encodedParamString is a string # paramName is a string # outStr is a CkString (output) status = httpResponse.UrlEncParamValue(encodedParamString, paramName, outStr); retStr = httpResponse.urlEncParamValue(encodedParamString, paramName);` |

## Properties

### HttpResponse.BodyQP

`Chilkat 11.7.0 · ckpython · HttpResponse · BodyQP · property · read-only`

```python
# strVal is a string

# ckStr is a CkString

httpResponse.get_BodyQP(ckStr);

strVal = httpResponse.bodyQP();
```

The same as the Body property, but returned as a quoted-printable encoded string.

### HttpResponse.BodyStr

`Chilkat 11.7.0 · ckpython · HttpResponse · BodyStr · property · read-only`

```python
# strVal is a string

# ckStr is a CkString

httpResponse.get_BodyStr(ckStr);

strVal = httpResponse.bodyStr();
```

The response body returned as a string.

### HttpResponse.Charset

`Chilkat 11.7.0 · ckpython · HttpResponse · Charset · property · read-only`

```python
# strVal is a string

# ckStr is a CkString

httpResponse.get_Charset(ckStr);

strVal = httpResponse.charset();
```

The response charset, such as `iso-8859-1`, if applicable. Obviously, responses for GIF and JPG files will not have a charset.

### HttpResponse.ContentLength

`Chilkat 11.7.0 · ckpython · HttpResponse · ContentLength · property · read-only`

```python
# intVal is a unsigned long

intVal = httpResponse.get_ContentLength();
```

The content length of the response, in bytes.

### HttpResponse.ContentLength64

`Chilkat 11.7.0 · ckpython · HttpResponse · ContentLength64 · property · read-only`

```python
# int64Val is a 64-bit integer

int64Val = httpResponse.get_ContentLength64();
```

The content length of the response, in number of bytes, returned as a 64-bit integer.

### HttpResponse.DateStr

`Chilkat 11.7.0 · ckpython · HttpResponse · DateStr · property · read-only`

```python
# strVal is a string

# ckStr is a CkString

httpResponse.get_DateStr(ckStr);

strVal = httpResponse.dateStr();
```

Returns the content of the Date response header field in RFC822 date/time string format.

### HttpResponse.Domain

`Chilkat 11.7.0 · ckpython · HttpResponse · Domain · property · read-only`

```python
# strVal is a string

# ckStr is a CkString

httpResponse.get_Domain(ckStr);

strVal = httpResponse.domain();
```

The domain of the HTTP server that created this response.

### HttpResponse.FinalRedirectUrl

`Chilkat 11.7.0 · ckpython · HttpResponse · FinalRedirectUrl · property · read-only · since 9.5.0.49`

```python
# strVal is a string

# ckStr is a CkString

httpResponse.get_FinalRedirectUrl(ckStr);

strVal = httpResponse.finalRedirectUrl();
```

Returns the redirect URL for 301/302 responses.

### HttpResponse.FullMime

`Chilkat 11.7.0 · ckpython · HttpResponse · FullMime · property · read-only`

```python
# strVal is a string

# ckStr is a CkString

httpResponse.get_FullMime(ckStr);

strVal = httpResponse.fullMime();
```

Returns the full MIME (header + body) of the HTTP response.

### HttpResponse.Header

`Chilkat 11.7.0 · ckpython · HttpResponse · Header · property · read-only`

```python
# strVal is a string

# ckStr is a CkString

httpResponse.get_Header(ckStr);

strVal = httpResponse.header();
```

The full text of the response header.

### HttpResponse.NumCookies

`Chilkat 11.7.0 · ckpython · HttpResponse · NumCookies · property · read-only`

```python
# intVal is an integer

intVal = httpResponse.get_NumCookies();
```

The number of cookies included in the response.

### HttpResponse.NumHeaderFields

`Chilkat 11.7.0 · ckpython · HttpResponse · NumHeaderFields · property · read-only`

```python
# intVal is an integer

intVal = httpResponse.get_NumHeaderFields();
```

The number of response header fields.

### HttpResponse.StatusCode

`Chilkat 11.7.0 · ckpython · HttpResponse · StatusCode · property · read-only`

```python
# intVal is an integer

intVal = httpResponse.get_StatusCode();
```

The status code (as an integer) from the first line of an HTTP response. If the StatusLine = `HTTP/1.0 200 OK`, the response status code returned is 200.

### HttpResponse.StatusLine

`Chilkat 11.7.0 · ckpython · HttpResponse · StatusLine · property · read-only`

```python
# strVal is a string

# ckStr is a CkString

httpResponse.get_StatusLine(ckStr);

strVal = httpResponse.statusLine();
```

The first line of an HTTP response, such as `HTTP/1.0 200 OK`.

### HttpResponse.StatusText

`Chilkat 11.7.0 · ckpython · HttpResponse · StatusText · property · read-only · since 9.5.0.49`

```python
# strVal is a string

# ckStr is a CkString

httpResponse.get_StatusText(ckStr);

strVal = httpResponse.statusText();
```

The text that follows the status code in the 1st line of the HTTP response. For example, i the first line of an HTTP response is `HTTP/1.0 200 OK`, then this property contains `OK`.

### HttpResponse.UncommonOptions

`Chilkat 11.7.0 · ckpython · HttpResponse · UncommonOptions · property · read/write · since 9.5.0.89`

```python
# strVal is a string

# ckStr is a CkString

httpResponse.get_UncommonOptions(ckStr);

strVal = httpResponse.uncommonOptions();

httpResponse.put_UncommonOptions(strVal);
```

This is a catch-all property to be used for uncommon needs. Can be set to a list of the following comma separated keywords:

- `TakeResponseBody` - Introduced in v9.5.0.89. The GetBody\* methods will transfer the body to the target object instead of copying the contents. This can be useful if the response body is extremely large because it will reduce the overall memory requirement.

## Methods

### HttpResponse.GetBodyBd

`Chilkat 11.7.0 · ckpython · HttpResponse · GetBodyBd · method · since 9.5.0.64`

```python
# binData is a CkBinData

status = httpResponse.GetBodyBd(binData);
```

Copies the response body to a BinData object.

Returns True for success, False for failure.

### HttpResponse.GetBodyJarr

`Chilkat 11.7.0 · ckpython · HttpResponse · GetBodyJarr · method · since 9.5.0.89`

```python
# jarr is a CkJsonArray

status = httpResponse.GetBodyJarr(jarr);
```

Loads the JSON array response body into a JsonArray This method should only be called when it is known that the response body contains a JSON array (beginning with a square bracket '\[' and ending with a square bracket '\]')

Returns True for success, False for failure.

### HttpResponse.GetBodyJson

`Chilkat 11.7.0 · ckpython · HttpResponse · GetBodyJson · method · since 9.5.0.89`

```python
# json is a CkJsonObject

status = httpResponse.GetBodyJson(json);
```

Loads the JSON response body into a JsonObject. This method should only be called when it is known that the response body contains JSON (beginning with a curly brace '{' and ending with a curly brace '}')

Returns True for success, False for failure.

### HttpResponse.GetBodySb

`Chilkat 11.7.0 · ckpython · HttpResponse · GetBodySb · method · since 9.5.0.64`

```python
# sb is a CkStringBuilder

status = httpResponse.GetBodySb(sb);
```

Copies the response body to a Chilkat StringBuilder object.

Returns True for success, False for failure.

### HttpResponse.GetBodyXml

`Chilkat 11.7.0 · ckpython · HttpResponse · GetBodyXml · method · since 9.5.0.89`

```python
# xml is a CkXml

status = httpResponse.GetBodyXml(xml);
```

Loads the XML response body into an XML object. This method should only be called when it is known that the response body contains XML.

Returns True for success, False for failure.

### HttpResponse.GetCookieDomain

`Chilkat 11.7.0 · ckpython · HttpResponse · GetCookieDomain · method`

```python
# index is an integer

# outStr is a CkString (output)

status = httpResponse.GetCookieDomain(index, outStr);

retStr = httpResponse.getCookieDomain(index);
```

Returns the domain of the Nth cookie in the response. Indexing begins at 0. The number of response cookies is specified in the NumCookies property.

Returns True for success, False for failure.

### HttpResponse.GetCookieExpiresStr

`Chilkat 11.7.0 · ckpython · HttpResponse · GetCookieExpiresStr · method`

```python
# index is an integer

# outStr is a CkString (output)

status = httpResponse.GetCookieExpiresStr(index, outStr);

retStr = httpResponse.getCookieExpiresStr(index);
```

Returns the expiration date/time of the Nth cookie in the response. Indexing begins at 0. The number of response cookies is specified in the NumCookies property.

Returns True for success, False for failure.

### HttpResponse.GetCookieName

`Chilkat 11.7.0 · ckpython · HttpResponse · GetCookieName · method`

```python
# index is an integer

# outStr is a CkString (output)

status = httpResponse.GetCookieName(index, outStr);

retStr = httpResponse.getCookieName(index);
```

Returns the name of the Nth cookie returned in the response. Indexing begins at 0. The number of response cookies is specified in the NumCookies property.

Returns True for success, False for failure.

### HttpResponse.GetCookiePath

`Chilkat 11.7.0 · ckpython · HttpResponse · GetCookiePath · method`

```python
# index is an integer

# outStr is a CkString (output)

status = httpResponse.GetCookiePath(index, outStr);

retStr = httpResponse.getCookiePath(index);
```

Returns the path of the Nth cookie returned in the response. Indexing begins at 0. The number of response cookies is specified in the NumCookies property.

Returns True for success, False for failure.

### HttpResponse.GetCookieValue

`Chilkat 11.7.0 · ckpython · HttpResponse · GetCookieValue · method`

```python
# index is an integer

# outStr is a CkString (output)

status = httpResponse.GetCookieValue(index, outStr);

retStr = httpResponse.getCookieValue(index);
```

Returns the value of the Nth cookie returned in the response. Indexing begins at 0. The number of response cookies is specified in the NumCookies property.

Returns True for success, False for failure.

### HttpResponse.GetHeaderField

`Chilkat 11.7.0 · ckpython · HttpResponse · GetHeaderField · method`

```python
# fieldName is a string

# outStr is a CkString (output)

status = httpResponse.GetHeaderField(fieldName, outStr);

retStr = httpResponse.getHeaderField(fieldName);
```

Returns the value of a response header field accessed by field name.

Returns True for success, False for failure.

### HttpResponse.GetHeaderFieldAttr

`Chilkat 11.7.0 · ckpython · HttpResponse · GetHeaderFieldAttr · method`

```python
# fieldName is a string

# attrName is a string

# outStr is a CkString (output)

status = httpResponse.GetHeaderFieldAttr(fieldName, attrName, outStr);

retStr = httpResponse.getHeaderFieldAttr(fieldName, attrName);
```

Returns a response header field attribute. As an example, the response charset is simply the GetHeaderFieldAttr(`content-type`,`charset`)

Returns True for success, False for failure.

### HttpResponse.GetHeaderName

`Chilkat 11.7.0 · ckpython · HttpResponse · GetHeaderName · method`

```python
# index is an integer

# outStr is a CkString (output)

status = httpResponse.GetHeaderName(index, outStr);

retStr = httpResponse.getHeaderName(index);
```

Gets the name of the Nth response header field. Indexing begins at 0. The number of response headers is specified by the NumHeaderFields property.

Returns True for success, False for failure.

### HttpResponse.GetHeaderValue

`Chilkat 11.7.0 · ckpython · HttpResponse · GetHeaderValue · method`

```python
# index is an integer

# outStr is a CkString (output)

status = httpResponse.GetHeaderValue(index, outStr);

retStr = httpResponse.getHeaderValue(index);
```

Gets the value of the Nth response header field. Indexing begins at 0. The number of response headers is specified by the NumHeaderFields property.

Returns True for success, False for failure.

### HttpResponse.LoadTaskResult

`Chilkat 11.7.0 · ckpython · HttpResponse · LoadTaskResult · method · since 9.5.0.52`

```python
# task is a CkTask

status = httpResponse.LoadTaskResult(task);
```

Loads the HTTP response from a completed asynchronous task. A failed return value indicates that no HTTP response was received in the HTTP asynchronous method call (i.e. the asynchronous HTTP request failed in such a way that no response was received).

Returns True for success, False for failure.

### HttpResponse.SaveBodyBinary

`Chilkat 11.7.0 · ckpython · HttpResponse · SaveBodyBinary · method`

```python
# path is a string

status = httpResponse.SaveBodyBinary(path);
```

Saves the body of the HTTP response to a file.

Returns True for success, False for failure.

### HttpResponse.SaveBodyText

`Chilkat 11.7.0 · ckpython · HttpResponse · SaveBodyText · method`

```python
# bCrlf is a boolean

# path is a string

status = httpResponse.SaveBodyText(bCrlf, path);
```

Saves the HTTP response body to a file. This method provides control over CRLF vs bare-LF line-endings. If `bCrlf` is `True`, then line endings are automatically converted to CRLF if necessary. If `bCrlf` is `False`, then line-endings are automatically converted to bare-LF's (Unix style) if necessary.

To save the HTTP response body exactly as-is (with no line-ending manipulation), then call SaveBodyBinary.

Returns True for success, False for failure.

### HttpResponse.UrlEncParamValue

`Chilkat 11.7.0 · ckpython · HttpResponse · UrlEncParamValue · method`

```python
# encodedParamString is a string

# paramName is a string

# outStr is a CkString (output)

status = httpResponse.UrlEncParamValue(encodedParamString, paramName, outStr);

retStr = httpResponse.urlEncParamValue(encodedParamString, paramName);
```

Convenience method for parsing a param's value out of a URL-encoded param string. For example, if a caller passes the following string in `encodedParamString`:

```
oauth_token=ABC&oauth_token_secret=123&oauth_callback_confirmed=true
```

and `oauth_token_secret` in `paramName`, then the return value would be `123`.

Returns True for success, False for failure.

## Related classes

[`BinData`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/ckpython/classes/BinData.md), [`JsonArray`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/ckpython/classes/JsonArray.md), [`JsonObject`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/ckpython/classes/JsonObject.md), [`StringBuilder`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/ckpython/classes/StringBuilder.md), [`Task`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/ckpython/classes/Task.md), [`Xml`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/ckpython/classes/Xml.md)

