GXHTTP class

class GXHTTP(handle=0)

GXHTTP class.

Connect to an Internet Server using GXHTTP.

Note:

References:

  1. http://www.w3.org/Protocols/GXHTTP/HTTP2.html
  2. http://www.w3.org/Addressing/URL/5_BNF.html

Note that path and search must conform be xalpha string (ref 2.). Special characters can be specified with a %xx, where xx is the hex ASCII number. For example, a search string “This one” should be specified as “This%20one”

classmethod create(url, user_name, password, purpose)

This method creates a connection to an GXHTTP server

Parameters:
  • url (str) – URL of the server
  • user_name (str) – User name, “” for none
  • password (str) – Password, “” for none
  • purpose (str) – Purpose of communication (for user verification)
Returns:

GXHTTP Object

Return type:

GXHTTP

New in version 5.0.

License: Geosoft Open License

Note: An OM user has the ability to control access and verification of access to servers over the Internet. A GX Developer has no way to change the users choice of access. This is to prevent the creation of GX’s that may be dangerous or may be used to collect information without the knowledgede of the user.

If the specified URL is restricted from access by the user, the create function will fail.

If the specified URL has not been accessed by this user before, or if the user has this site on “Verify”, the user will be presented with a dialog requiring verification before communication can begin. The user may choose to change the server site to a full “Trust” relationship, in which case the verification message will not reappear unless the site is explicitly changed back to verify or is restricted.

If you intend your GX to communicate with a server without verification, you must instruct your user to change their trust relationship with your server to “Trusted”. Your user will have the opportunity to do so the first time a script is run.

download(file, bf, dynamic)

Download file from the internet to a GXBF.

Parameters:
  • file (str) – File Name on the GXHTTP site
  • bf (GXBF) – GXBF in which to place the file
  • dynamic (int) – Dynamic content (0 - no, 1 - yes)

New in version 5.0.

License: Geosoft Open License

Note: The file will be written starting at the current location in the GXBF

get(cl, method, bf, ret_bf)

Get data from a server.

Parameters:
  • cl (str) – Http path (file or an ISAPI DLL), no spaces
  • method (str) – Http search string, no spaces
  • bf (GXBF) – Data to send
  • ret_bf (GXBF) – Data returned

New in version 5.0.

License: Geosoft Open License

Note: Full contents of the GXBF are sent in an GXHTTP GET message. GXBF pointer is returned to location before the call.

request URL will be: http://server/path?search

is_null()

Check if this is a null (undefined) instance

Returns:True if this is a null (undefined) instance, False otherwise.
Return type:bool
classmethod null()

A null (undefined) instance of GXHTTP

Returns:A null GXHTTP
Return type:GXHTTP
post(cl, method, bf)

Post data to the server.

Parameters:
  • cl (str) – Http path (file or an ISAPI DLL)
  • method (str) – Http search string, no spaces
  • bf (GXBF) – Data to post

New in version 5.0.

License: Geosoft Open License

Note: Full contents of the GXBF are sent as an GXHTTP POST message.

request URL will be: http://server/path?search

set_proxy_credentials(username, password)

Assigns the proxy username and password so that user is not prompted when the first download fails

Parameters:
  • username (str) – Username
  • password (str) – Password

New in version 7.2.

License: Geosoft Open License

silent_download(file, bf, dynamic)

Download file from the internet to a GXBF with no prompt for proxy authentication.

Parameters:
  • file (str) – File Name on the GXHTTP site
  • bf (GXBF) – GXBF in which to place the file
  • dynamic (int) – Dynamic content (0 - no, 1 - yes)

New in version 8.2.

License: Geosoft Open License

Note: The file will be written starting at the current location in the GXBF. No prompt for proxy authentication