QuickBooks Integrator 2020 Python Edition

Questions / Feedback?

QBConnector Class

Properties   Methods   Events   Configuration Settings   Errors  

The QBCONNECTOR class is a utility that allows you to connect your QuickBooks Integrator applications to remote QuickBooks instances.

Syntax

class inqb.QBConnector

Remarks

The QBConnector class is a lightweight web server which listens for HTTP requests originating from the QuickBooks Integrator classs. Each request sent to the QBConnector by a QuickBooks Integrator class contains the XML data to be communicated to QuickBooks as well as configuration settings specifying how the connection is to be opened. The QBConnector then communicates with QuickBooks via COM, and returns the QuickBooks response (or an error message) in the HTTP reply.

Using the QBConnector class is easy. Simply set listening to True, and the class will begin listening for incoming messages on the specified local_port. The messages will be processed by the QuickBooks application that is running on the same machine as the QBConnector, and the results will automatically be returned to the requesting client.

Basic authentication is enabled by default, meaning the connecting clients must present a user name and password in the QBConnectionString of the class they're using. The supplied user name and password are checked against the list of authorized_users. If no user in the list matches the supplied credentials, the on_authorization event will fire with the Accept parameter set to false. If the user was found in the list of authorized_users then the parameter will be set to True. You may override this functionality by setting the Accept parameter inside the on_authorization event manually. If no "Authorization" header supplied in the request, the on_authorization event will fire with blank User and Password parameters.

Note that the authorized_user_qb_connection_string will be used to make the connection to QuickBooks for a user found in the authorized_users collection.

Any of the QuickBooks Integrator classs can connect to the QBConnector using the QBConnectionString property of any of the classs. For instance, an example using the Invoice class follows:

  Invoice.QBConnectionString = "URL='http://www.foo.com:2080'" User='Foo' Password='Bar'";

Using SSL along with a digital certificate greatly increases the security of the Remote Connector. SSL will encrypt all data transmitted across the network, ensuring that only the Connector can read incoming requests, and that only the requesting client can read the QuickBooks responses. This prevents unauthorized parties from accessing your QuickBooks data. You should use a full digital certificate on the server (Connector) side, and this will contain a public key and a private key. This version of your certificate should be kept private. You may export a version of the certificate containing the public key only, and distribute this to all clients that need to communicate with the Connector.

To use this functionality, set the ssl_cert with a valid certificate and then change the ssl_start_mode to sslImplicit. Now all clients must post to the QBConnector using HTTPS. eg:

  Invoice.QBConnectionString = "URL='https://www.foo.com:2080' User='Foo' Password='Bar'"; // https instead of http

The client (in these examples Invoice) has an SSLServerAuthentication event that will fire when the server presents its certificate. If the public key presented by the QBConnector is trusted by the system, the Accept parameter will be True. If it is not trusted by the system (Accept is False), you should inspect the certificate and if valid, override by setting Accept to True.

Property List


The following is the full list of the properties of the class with short descriptions. Click on the links for further details.

authorized_user_countThe number of records in the Authorized arrays.
authorized_auth_modeThis property defines how the user is authorized.
authorized_user_passwordA password associated with the User who is allowed to connect to the class.
authorized_user_qb_connection_stringAn aggregate consisting of various QuickBooks connection properties that are used to connect the authorized client to the QuickBooks application.
authorized_userName of a user which is allowed to connect to the class.
connected_to_qbOpens or closes a persistent connection to QuickBooks.
enable_sslIndicates whether server starts in SSL-mode.
listeningIf True, the class accepts incoming connections on LocalPort.
local_hostThe name of the local host or user-assigned IP interface through which connections are initiated or accepted.
local_portThe TCP port in the local host where the class listens.
ssl_authenticate_clientsIf true, the server asks the client(s) for a certificate.
ssl_cert_encodedThe certificate (PEM/base64 encoded).
ssl_cert_storeThe name of the certificate store for the client certificate.
ssl_cert_store_passwordIf the certificate store is of a type that requires a password, this property is used to specify that password in order to open the certificate store.
ssl_cert_store_typeThe type of certificate store for this certificate.
ssl_cert_subjectThe subject of the certificate used for client authentication.
timeoutAn initial timeout value to be used by incoming connections.

Method List


The following is the full list of the methods of the class with short descriptions. Click on the links for further details.

add_userAdds a new user to the AuthorizedUsers collection.
configSets or retrieves a configuration setting.
do_eventsProcesses events from the internal message queue.
resetClears all properties to their default values.
shutdownShutdown the server.

Event List


The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.

on_authorizationFired when the client presents its credentials to the server.
on_connectedFired immediately after a connection completes (or fails).
on_connection_requestFired when a request for connection comes from a remote host.
on_disconnectedFired when a connection is closed.
on_errorInformation about errors during data delivery.
on_headerHTTP headers sent by the client.
on_requestFired when a client sends a request to the class.
on_responseFired when the class sends a response to the client.
on_ssl_client_authenticationFired when the client presents its credentials to the server.
on_ssl_connection_requestFires when an SSL connection is requested.
on_ssl_statusShows the progress of the secure connection.
on_statusShows the status of the server as clients connect and transactions are made.

Configuration Settings


The following is a list of configuration settings for the class with short descriptions. Click on the links for further details.

AuthFlagsAuth Flags to use when connecting to QuickBooks.
ConnectedToQBUsed to connect or disconnect from QuickBooks.
DefaultConnectionStringDefault connection string to use for users not in the AuthorizedUsers collection.
ReadOnly[i]Whether a user is restricted to read-only access.
UseInteractiveLogonWhether interactive or network logon is used when AuthMode is set to Windows.
BuildInfoInformation about the product's build.
CodePageThe system code page used for Unicode to Multibyte translations.
LicenseInfoInformation about the current license.
ProcessIdleEventsWhether the class uses its internal event loop to process events when the main thread is idle.
SelectWaitMillisThe length of time in milliseconds the class will wait when DoEvents is called if there are no events to process.
UseInternalSecurityAPITells the class whether or not to use the system security libraries or an internal implementation.

Copyright (c) 2021 /n software inc. - All rights reserved.
QuickBooks Integrator 2020 Python Edition - Version 20.0 [Build 7941]