post_data Property

The data to post with the URL if the POST method is used.

Syntax

def get_post_data() -> bytes: ...
def set_post_data(value: bytes) -> None: ...

post_data = property(get_post_data, set_post_data)

Default Value

""

Remarks

If this method is a non-empty string, then if the HTTP post method is used. The contents of this property are appended to the HTTP request after the HTTP headers.

An HTTP 'Content-Length' header is also added to the request. Its value is the length of the string in post_data, or, if the attached_file property has been set, the cumulative length of the string and the file. See the description of the attached_file property for details.

If the goal is to upload a file or binary form data to a receiving script, the postdata must be MIME encoded. The WebUpload component is specifically designed for this and will perform all of the MIME encoding for you automatically. The WebForm component can be used for any form data posting.

The most common example is posting of HTML form input data. In that case, the content_type property must be set to "application/x-www-form-urlencoded".

Example (Performing a Post)


HTTPControl.ContentType = "application/x-www-form-urlencoded"
HTTPControl.PostData = "firstname=Tom&lastname=Thompson&country=US"
HTTPControl.Post(myurl)

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks 2020 Python Edition - Version 20.0 [Build 8307]