Search

User Manual

GETTING STARTED


MODULES AND PLATFORM


APPENDIX


TUTORIALS & HELPFUL TRICKS


GLOSSARY


STRATEGIC PARTNER LINKS

Sepasoft - MES Modules
Cirrus Link - MQTT Modules

RESOURCES

Inductive University
Ignition Demo Project
Knowledge Base Articles
Forum
IA Support
SDK Documentation
SDK Examples

ALL MANUAL VERSIONS

Ignition 8.1
Ignition 7.9
Ignition 7.8

Deprecated Pages

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

This function is used in Python Scripting.

Description

Provides a general use object that can be used to send and receive RESTful HTTP requests. The object created by this function is a wrapper around Java's HttpClient class. Typical use involves creating the a JythonHttpClient object with a call to system.net.httpClient, and then utilizing the varous methods (get(), post(), etc) on the JythonHttpClient to handle requests.

Client Permission Restrictions

This scripting function has no Client Permission restrictions.

Syntax

system.net.httpClient()

  • Parameters

Integer timeout - A value, in milliseconds, to set the client’s connect timeout setting to. [Optional - Defaults to 60000]

Boolean bypass_cert_validation - A value, in milliseconds, to set the client’s read timeout setting to. [Optional - Defaults to False]

String username - A string indicating the username to use for authentication if the remote server requests authentication; specifically, by responding with a WWW-Authenticate or Proxy-Authenticate header. Only supports Basic authorization. If username is present but not password, an empty string will be used for password. [Optional - Defaults to None]

String password - A string indicating the password to use for authentication. [Optional - Defaults to None]

String proxy - The address of a proxy, which will be used for HTTP and HTTPS traffic. If the port is not specified, it will be assumed from the protocol in the URL, i.e. 80/443. [Optional - Defaults to None]

String cookie_policy - A string representing this client’s cookie policy. Accepts values "ACCEPT_ALL", "ACCEPT_NONE", and "ACCEPT_ORIGINAL_SERVER" . [Defaults to "ACCEPT_ORIGINAL_SERVER"]

String redirect_policy - A string representing this client’s redirect policy. Acceptable values are listed below. [Optional - Defaults to "Normal"]

                    • "NEVER" - never allow redirects
                    • "ALWAYS" - allow redirects,
                    • "NORMAL" - allows redirects, except those that would downgrade to insecure addresses (i.e., HTTPS redirecting to HTTP).

Callable customizer - A reference to a callable function. This function will be called with one argument (an instance of HttpClient.Builder). The function should operate on the builder class and allows for arbitrary customization of the created HTTP client. [Optional - Defaults to None]

  • Returns

JythonHttpClient  -  An object wrapped around an instance of Java's HttpClient class. The client object has methods that can be called against a website to get or send information through the web. See the panel below for more details.

  • Scope

Gateway, Vision Client, Perspective Session

JythonHttpClient

Once a JythonHttpClient object has been created, HTTP calls can be made with the build in methods detailed below. The various methods available on this object can be split under different categories.

 Synchronous Calls

This section details synchronous methods. Each method in this section returns a Response object.

Methods

The following methods return a Response object. Parameters for these functions are documented below.

  • .get()
  • .post()
  • .put()
  • .delete()
  • .head()
  • .patch()
  • .options()
  • .trace()


Parameters

Parameters in this section can be used by any of the methods above. Exceptions to this rule will be defined on each parameter.

String url - The URL to connect to. [Required]

String or Dictionary parameters - Parameters to append to the URL. If supplied as a string, will be directly appended to the URL. If supplied as a dictionary, key/value pairs will be automatically URL encoded.

String or Dictionary or byte[] - Data to send in the request.

            • String data will be sent with a Context-Type of "text/plain; charset=UTF-8", unless the Content-Type header was already specified
            • Dictionary data will be automatically encoded into JSON. The Content-Type header will be set to "application/json;charset=UTF-8" unless the Content-Type header was already specified.
            • Byte arrays will be sent directly, and set the Content-Type header to application/octet-stream unless the Content-Type heaer was already specified.

String username - A string indicating the username to use for authentication if the remote server requests authentication; specifically, by responding with a WWW-Authenticate or Proxy-Authenticate header. Only supports Basic authorization. If username is present but not password, an empty string will be used for password. [Optional - Defaults to None]

String password - A string indicating the p


 Click here to expand...

.get()

 Click here for parameters...



.post()

 Click here for parameters...



.put()

.delete()

.head()

.patch()

.options()

.trace()

.request()

Code Examples
Code Snippet
 
Code Snippet
 
  • No labels