### Automated SDK installation and setup Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/README.md Importing the library triggers automatic platform checks, SDK verification, and installation of necessary dependencies like pywin32 and pandas. ```python from qbdesktop import RequestProcessor # precheck() runs automatically on import # SDK installation happens if needed ``` -------------------------------- ### precheck() Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/installer-utilities.md Performs pre-installation checks and setup, serving as the main entry point for installation verification. ```APIDOC ## precheck() ### Description Performs pre-installation checks and setup. This is the main entry point for installation verification. ### Signature `def precheck() -> None` ### Returns - **None** ``` -------------------------------- ### Installation Utilities Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/MODULE-INDEX.md Functions for verifying and managing the SDK installation environment. ```APIDOC ## precheck() Verifies and installs the SDK. ## is_windows() Checks if the current platform is Windows. ## ensure_installation() Installs the SDK if it is missing. ## split_exe(path, folder) Splits a large binary executable into chunks. ## combine_chunks(folder, path) Combines binary chunks back into a single file. ``` -------------------------------- ### Importing Classes and Functions Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/MODULE-INDEX.md Standard import patterns for classes from the qbdesktop module and installer functions from the installer module. ```python from qbdesktop import ClassName ``` ```python from installer import function_name ``` -------------------------------- ### Manage SDK Installation Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/MODULE-INDEX.md Utility functions for verifying and managing the QuickBooks SDK installation environment. ```python precheck() # Verify and install SDK is_windows() # Check platform ensure_installation() # Install if missing split_exe(path, folder) # Split large binary combine_chunks(folder, path) # Combine chunks ``` -------------------------------- ### ensure_installation() Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/installer-utilities.md Ensures the QuickBooks SDK is properly installed on the system, performing automated downloads and installation if necessary. ```APIDOC ## ensure_installation() ### Description Ensures the QuickBooks SDK is properly installed on the system. If the SDK is not found at the expected location, it automatically downloads, combines split installer files, runs the installer, and installs required tools. ### Signature `def ensure_installation() -> None` ### Returns - **None** ``` -------------------------------- ### Installation Check Sequence Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/installer-utilities.md Visual representation of the installation workflow from platform check to final execution. ```text is_windows() ↓ (check platform) precheck() ↓ (verify/setup) combine_chunks() ↓ (assemble installer) ensure_installation() ↓ (run installers) ``` -------------------------------- ### Importing qbdesktop Classes and Installer Functions Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/README.md Use these imports to access the main library classes and SDK installation utilities. ```python # Import individual classes from qbdesktop import RequestProcessor, SessionManager, WebConnector from qbdesktop import Element, Aggregate, MessageAggregate, Param from qbdesktop import QBAgingReport, QBJobReport, QBAgingRequest from qbdesktop import QuickBooksResponse # Import installer functions from installer import precheck, is_windows, ensure_installation ``` -------------------------------- ### Usage Examples Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/quickbooks-request-processor.md Demonstrates both recommended context manager usage and manual session management. ```python from qbdesktop import RequestProcessor # Using context manager (recommended) with RequestProcessor("MyApp") as processor: xml_response = processor.process_request("data") print(xml_response) # Connection and session are automatically cleaned up # Manual management processor = RequestProcessor("MyApp") processor.open_connection() processor.begin_session() try: response = processor.process_request("...") finally: processor.end_session() processor.close_connection() ``` -------------------------------- ### Begin Session Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/quickbooks-request-processor.md Method to start a QuickBooks session and store the ticket. ```python def begin_session(self) -> None: ``` -------------------------------- ### Installation and Platform Prechecks Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/QUICK-REFERENCE.md Perform manual prechecks or verify the operating system platform using the provided installer utilities. ```python # Automatic on import from qbdesktop import RequestProcessor # precheck() runs here # Manual from installer import precheck precheck() # Verify platform, combine chunks, install SDK # Check platform from installer import is_windows if is_windows(): # Windows-specific code pass ``` -------------------------------- ### Perform Pre-installation Checks Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/installer-utilities.md Execute the primary entry point for verifying system requirements and SDK installation. ```python def precheck() -> None: ``` -------------------------------- ### Import Installer Utilities Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/installer-utilities.md Import the necessary utility functions from the installer module. ```python from installer import precheck, is_windows, ensure_installation, split_exe, combine_chunks ``` -------------------------------- ### Param Usage Example Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/xml-building-classes.md Demonstrates creating a Param instance and generating its string representation. ```python from qbdesktop import Param param = Param("requestID", "1") print(param.read()) # Output: requestID="1" ``` -------------------------------- ### Ensure QuickBooks SDK Installation Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/installer-utilities.md Verify the presence of the QuickBooks SDK and perform automated installation if missing. ```python def ensure_installation() -> None: ``` -------------------------------- ### Define QuickBooks SDK Installation Path Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/configuration.md Specifies the default installation directory for QuickBooks SDK version 16.0. ```python qb_sdk_path = "C:\\Program Files\\Intuit\\IDN\\QBSDK16.0" ``` -------------------------------- ### Usage Example for Element Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/xml-building-classes.md Demonstrates creating elements and generating their XML representation. ```python from qbdesktop import Element elem = Element("Name", "John Doe", indent=3) print(elem.read()) # Output: John Doe elem2 = Element("Email", "john@example.com", indent=2) print(elem2.read()) # Output: john@example.com ``` -------------------------------- ### RequestAllData Usage Example Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/request-all-data.md Complete workflow for initializing the requester, sending a sync request, and cleaning up resources. ```python from qbdesktop import RequestAllData # Create instance and automatically open connection/session requester = RequestAllData( "C:\\Users\\Public\\Documents\\Intuit\\QuickBooks\\Company Files\\mycompany.qbw", 0 # qb_file_mode value ) # Send the full data sync request response = requester.send_request() # Process the response # The ResponseReader object can be used to access the XML response data # Resources are automatically cleaned up when the object is deleted del requester ``` -------------------------------- ### QuickBooksResponse Usage Example Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/quickbooks-response.md Demonstrates initializing the class with XML strings and accessing the resulting pandas DataFrame. ```python from qbdesktop import QuickBooksResponse # Create a response object from XML strings request_xml = "all" response_xml = """ John Doe john@example.com """ response = QuickBooksResponse(request=request_xml, response=response_xml) # Access the DataFrame print(response.dataframe) print(response.dataframe.head()) # Work with the data print(response.dataframe.columns) print(response.dataframe.dtypes) # Save as Excel (not yet implemented) # response.save_as_excel("output.xlsx") ``` -------------------------------- ### RequestProcessorDialog Usage Example Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/request-processor-dialog.md Complete workflow demonstrating initialization, showing a request, polling for completion, retrieving the response, and closing the dialog. ```python from qbdesktop import RequestProcessorDialog import time # Create dialog instance dialog = RequestProcessorDialog( "app_id_123", "MyApp", "C:\\Users\\Public\\Documents\\Intuit\\QuickBooks\\Company Files\\mycompany.qbw" ) # Show the dialog with an XML request xml_request = "all" dialog.show(xml_request) # Poll for completion while not dialog.is_done(): time.sleep(0.5) # Get the response response = dialog.get_response() print(response) # Close the dialog dialog.close() ``` -------------------------------- ### Execute precheck on import Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/installer-utilities.md Ensures the Windows platform is available and the SDK is installed immediately upon importing the module. ```python from installer import precheck precheck() # Executed immediately on import ``` -------------------------------- ### Construct XML Request Example Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/xml-building-classes.md Demonstrates creating a full XML structure using Elements, Aggregates, and a MessageAggregate with parameters. ```python from qbdesktop import Element, Aggregate, MessageAggregate, Param # Create elements name_elem = Element("Name", "John Doe", indent=3) email_elem = Element("Email", "john@example.com", indent=3) # Create aggregate customer_agg = Aggregate("Customer", elements=[name_elem, email_elem], indent=2) # Create message with parameters msg_param = Param("sessionID", "12345") message = MessageAggregate("CustomerQueryRs", aggregates=[customer_agg], indent=1, params=[msg_param]) print(message.read()) # Output: # # # John Doe # john@example.com # # ``` -------------------------------- ### Using QBJobReport Constants Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/aging-and-job-reports.md Example of referencing a specific job report type constant. ```python from qbdesktop import QBJobReport # Use constant for job report type report_type = QBJobReport.ItemEstimatesVsActuals print(report_type) # Output: 0 ``` -------------------------------- ### Usage Example for Aggregate Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/xml-building-classes.md Demonstrates creating an aggregate container, adding elements, and generating the final XML. ```python from qbdesktop import Element, Aggregate, Param # Create elements name_elem = Element("Name", "John Doe", indent=3) email_elem = Element("Email", "john@example.com", indent=3) # Create aggregate with parameter agg = Aggregate("Customer", elements=[name_elem, email_elem], indent=2) agg.add_element(Element("Phone", "555-1234", indent=3)) print(agg.read()) # Output: # # John Doe # john@example.com # 555-1234 # ``` -------------------------------- ### Executing Module-Level Precheck Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/README.md The qbdesktop module automatically triggers a platform validation and SDK installation check upon execution. ```python # qbdesktop.py automatically runs: from installer import precheck precheck() # Validates platform and installs SDK if needed ``` -------------------------------- ### Using QBAgingReport Constants Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/aging-and-job-reports.md Example of referencing a specific aging report type constant. ```python from qbdesktop import QBAgingReport # Use constants to identify report types report_type = QBAgingReport.GeneralDetail print(report_type) # Output: 3 ``` -------------------------------- ### Initiate SessionManager Session Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/configuration.md Uses SessionManager.begin to open a connection and start a session, followed by opening the Customer entity. ```python self.qb_session_manager.OpenConnection('', self.app_name) self.qb_session_manager.BeginSession(self.company_file_path, self.app_id) self.qb_session.OpenEntity('Customer', '') ``` -------------------------------- ### Define QuickBooks Tools Path Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/configuration.md Specifies the directory containing QB XML tools and installers within the SDK. ```python qb_xml_requester_path = "C:\\Program Files (x86)\\Intuit\\IDN\\QBSDK16.0\\tools\\installers" ``` -------------------------------- ### Initiate RequestProcessor Session Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/configuration.md Uses RequestProcessor.begin_session to start a session with an empty application ID and default session type. ```python self.ticket = self.qbxmlrp.BeginSession("", 0) ``` -------------------------------- ### Define make_broken_zip function Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/installer-utilities.md Utility function used to split the QB SDK installer into 20MB chunks. ```python def make_broken_zip() -> None: ``` -------------------------------- ### Get Full Company Data Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/QUICK-REFERENCE.md Uses RequestAllData to retrieve the entire company file data. ```python from qbdesktop import RequestAllData requester = RequestAllData("path/to/company.qbw", 0) response = requester.send_request() # QBXMLRP2.ResponseReader ``` -------------------------------- ### begin() Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/quickbooks-session-manager.md Opens a connection to QuickBooks and begins a session. ```APIDOC ## begin() ### Description Opens a connection to QuickBooks and begins a session. Opens the Customer entity for operations. ### Returns - None ``` -------------------------------- ### Initialize QuickBooks Connections Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/MODULE-INDEX.md Classes used to establish communication with QuickBooks Desktop. ```python RequestProcessor(app_name: str) SessionManager(app_id: str, app_name: str, company_file_path: str) RequestProcessorDialog(app_id: str, app_name: str, company_file_path: str) WebConnector(url: str) RequestAllData(company_file_path: str, qb_file_mode: int) ``` -------------------------------- ### Import XML Building Classes Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/xml-building-classes.md Import the necessary classes from the qbdesktop module to begin building XML structures. ```python from qbdesktop import Param, Element, Aggregate, MessageAggregate, qbXML ``` -------------------------------- ### Retrieve Response Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/request-processor-dialog.md Method signature to get the XML response string after processing is complete. ```python def get_response(self) -> str: ``` -------------------------------- ### Manage QuickBooks sessions Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/quickbooks-session-manager.md Demonstrates both the recommended context manager approach and manual session lifecycle management. ```python from qbdesktop import SessionManager # Using context manager (recommended) with SessionManager("app_id_123", "MyApp", "C:\\Users\\Public\\Documents\\Intuit\\QuickBooks\\Company Files\\mycompany.qbw") as session: # Query all customers customers = session.query_customers() print(customers) # Create a new customer customer_xml = """ John Doe 123 Main St """ result = session.create_customer(customer_xml) print(result) # Session is automatically closed # Manual management session = SessionManager("app_id", "MyApp", "path/to/company.qbw") session.begin() try: customers = session.query_customers() finally: session.end() ``` -------------------------------- ### RequestAllData Constructor Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/request-all-data.md Initializes a new RequestAllData instance, establishing a connection and session with the QuickBooks company file. ```APIDOC ## RequestAllData(company_file_path, qb_file_mode) ### Description Initializes a RequestAllData instance and establishes a connection to the QBXMLRP2.RequestProcessor. Opens a connection and begins a session immediately. ### Parameters - **company_file_path** (str) - Required - Full path to the QuickBooks company file - **qb_file_mode** (int) - Required - File mode for opening the company file ``` -------------------------------- ### Initialize and Execute WebConnector Workflow Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/web-connector.md Demonstrates the full lifecycle of a QuickBooks WebConnector session, including ticket acquisition, request processing, and connection closure. ```python from qbdesktop import WebConnector # Create connector instance connector = WebConnector("http://localhost:8080/quickbooks") # Get version information version = connector.get_version() print(f"QBWebConnector Version: {version}") # Obtain a ticket ticket = connector.get_ticket() print(f"Session Ticket: {ticket}") # Send an XML request xml_request = "all" response = connector.process_request(ticket, xml_request) print(f"Response: {response}") # Handle the response hresult = 0 message = "Request processed" success = connector.receive_response(ticket, response, hresult, message) # Close the connection connector.close(ticket) ``` -------------------------------- ### Import RequestProcessorDialog Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/request-processor-dialog.md Import the class from the qbdesktop module. ```python from qbdesktop import RequestProcessorDialog ``` -------------------------------- ### Implement __enter__ method Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/quickbooks-session-manager.md Defines the entry point for the context manager, which initiates the session. ```python def __enter__(self) -> SessionManager: ``` -------------------------------- ### Import QuickBooksResponse Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/quickbooks-response.md Import the class from the qbdesktop module. ```python from qbdesktop import QuickBooksResponse ``` -------------------------------- ### Initialize WebConnector Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/web-connector.md Constructor signature for creating a new WebConnector instance. ```python WebConnector(url: str) -> None ``` -------------------------------- ### Import RequestProcessor Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/quickbooks-request-processor.md Import the class from the qbdesktop module. ```python from qbdesktop import RequestProcessor ``` -------------------------------- ### begin_session() Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/quickbooks-request-processor.md Begins a QuickBooks session and stores the session ticket internally. ```APIDOC ## begin_session() ### Description Begins a QuickBooks session. Stores the session ticket internally in the ticket attribute. Must be called after opening a connection. ### Returns - None ``` -------------------------------- ### Clone and Run Project Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/README.md Commands to clone the repository and execute the main script. ```PowerShell git clone https://github.com/Donny-GUI/quickbooks-desktop-python.git cd quickbooks-desktop-python python qbdesktop.py ``` -------------------------------- ### Build a Customer Creation Request Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/xml-building-classes.md Constructs a CustomerAdd XML request using nested elements and aggregates. Requires the qbdesktop library imports. ```python from qbdesktop import Element, Aggregate, MessageAggregate, Param # Build a customer creation request name = Element("Name", "Jane Smith", indent=3) phone = Element("Phone", "555-9999", indent=3) addr1 = Element("Addr1", "456 Oak Ave", indent=3) # Create CustomerAdd aggregate customer_add = Aggregate("CustomerAdd", elements=[name, phone, addr1], indent=2) # Create top-level message param = Param("requestID", "1") message = MessageAggregate("CustomerAddRq", aggregates=[customer_add], indent=1, params=[param]) # Get XML string xml_string = message.read() print(xml_string) ``` -------------------------------- ### Open Connection Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/quickbooks-request-processor.md Method to establish a connection to QuickBooks. ```python def open_connection(self) -> None: ``` -------------------------------- ### WebConnector(url) Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/web-connector.md Initializes a new instance of the WebConnector class and establishes a connection to the specified QBWC web service. ```APIDOC ## WebConnector(url) ### Description Initializes a WebConnector instance and establishes the underlying COM connection to QBWebConnector.QBWebConnectorSvc. ### Signature `WebConnector(url: str) -> None` ### Parameters - **url** (str) - Required - URL of the QBWC web service ``` -------------------------------- ### Process QuickBooks XML Request Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/README.md Demonstrates initializing a QuickBooks session and executing an XML query request. ```Python3 from QuickBooks import QuickBooks, XMLRequest with QuickBooks() as qbxmlrp: response = qbxmlrp.process_request(XMLRequest.all_queries) print(response) ``` -------------------------------- ### Import WebConnector Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/web-connector.md Import the WebConnector class from the qbdesktop package. ```python from qbdesktop import WebConnector ``` -------------------------------- ### Initialize RequestProcessorDialog Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/request-processor-dialog.md Constructor signature for initializing the dialog with application credentials and company file path. ```python RequestProcessorDialog(app_id: str, app_name: str, company_file_path: str) -> None ``` -------------------------------- ### Display Project Documentation Navigation Structure Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/DOCUMENTATION-SUMMARY.md Visual representation of the documentation directory hierarchy for the quickbooks-desktop-python project. ```text QUICK-REFERENCE.md (Start here) ├── README.md (Overview) ├── MODULE-INDEX.md (Find by name) └── api-reference/ (Detailed reference) └── [specific class].md └── types.md (Type definitions) └── configuration.md (Settings) └── installer-utilities.md (Installation) ``` -------------------------------- ### Use QBAgingRequest in XML requests Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/aging-and-job-reports.md Demonstrates using the defined constants to build XML requests for QuickBooks. ```python from qbdesktop import QBAgingRequest # Use constants to build XML requests request_element = QBAgingRequest.GeneralDetail print(request_element) # Output: GeneralDetailReportQueryRq # Use in XML building from qbdesktop import MessageAggregate message = MessageAggregate(QBAgingRequest.GeneralSummary) xml = message.read() ``` -------------------------------- ### Build a QuickBooks Report Request Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/aging-and-job-reports.md Demonstrates selecting a report type and initializing a MessageAggregate with the corresponding XML request element. ```python from qbdesktop import QBAgingReport, QBAgingRequest, MessageAggregate # Select a report type report_type_id = QBAgingReport.GeneralSummary # Build XML request using corresponding request element request_element = QBAgingRequest.GeneralSummary # Create the XML request message = MessageAggregate(request_element) ``` -------------------------------- ### RequestProcessor(app_name) Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/quickbooks-request-processor.md Initializes a new RequestProcessor instance and establishes the underlying COM connection to QBXMLRP2. ```APIDOC ## RequestProcessor(app_name) ### Description Initializes a RequestProcessor instance and establishes the underlying COM connection to QBXMLRP2. Throws an exception if the COM object cannot be instantiated. ### Parameters - **app_name** (str) - Required - The name of the application connecting to QuickBooks ``` -------------------------------- ### Initialize SessionManager Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/quickbooks-session-manager.md Constructor signature for initializing the SessionManager with application credentials and a company file path. ```python SessionManager(app_id: str, app_name: str, company_file_path: str) -> None ``` -------------------------------- ### RequestProcessorDialog Constructor Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/request-processor-dialog.md Initializes a new instance of the RequestProcessorDialog and establishes the COM connection. ```APIDOC ## RequestProcessorDialog(app_id, app_name, company_file_path) ### Description Initializes a RequestProcessorDialog instance and establishes the underlying COM connection to QBXMLRP2UI.RequestProcessorDialog. ### Parameters - **app_id** (str) - Required - The application ID for QuickBooks identification - **app_name** (str) - Required - The human-readable name of the application - **company_file_path** (str) - Required - Full path to the QuickBooks company file ``` -------------------------------- ### Import SessionManager Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/quickbooks-session-manager.md Import the SessionManager class to begin managing QuickBooks sessions. ```python from qbdesktop import SessionManager ``` -------------------------------- ### Initialize RequestProcessor Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/quickbooks-request-processor.md Constructor signature for initializing the processor with an application name. ```python RequestProcessor(app_name: str) -> None ``` -------------------------------- ### RequestProcessor Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/QUICK-REFERENCE.md Handles the core connection lifecycle to QuickBooks Desktop. ```APIDOC ## RequestProcessor ### Description Manages the connection and session lifecycle for QuickBooks Desktop requests. ### Methods - `__init__(app_name: str)`: Initializes the processor. - `open_connection()`: Opens the connection to QuickBooks. - `close_connection()`: Closes the connection. - `begin_session()`: Starts a session. - `end_session()`: Ends the session. - `process_request(request: str) -> str`: Sends an XML request and returns the response. ``` -------------------------------- ### SessionManager Constructor Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/quickbooks-session-manager.md Initializes a new SessionManager instance and establishes the underlying COM connection to QuickBooks. ```APIDOC ## SessionManager(app_id, app_name, company_file_path) ### Description Initializes a SessionManager instance and establishes the underlying COM connection to QBFC13.QBSessionManager. ### Parameters - **app_id** (str) - Required - The application ID for QuickBooks identification - **app_name** (str) - Required - The human-readable name of the application - **company_file_path** (str) - Required - Full path to the QuickBooks company file ``` -------------------------------- ### Define DEFAULT_COMPANY_FILE constant Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/configuration.md Sets the default Windows path for QuickBooks company files. ```python DEFAULT_COMPANY_FILE = f"C:\\Users\\Public\\Documents\\Intuit\\QuickBooks\\Company Files" ``` -------------------------------- ### QuickBooksResponse Constructor Signature Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/quickbooks-response.md Constructor definition for initializing the response object with XML strings. ```python QuickBooksResponse(request: str = None, response: str = None) -> None ``` -------------------------------- ### open_connection() Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/quickbooks-request-processor.md Opens a connection to QuickBooks. Must be called before beginning a session. ```APIDOC ## open_connection() ### Description Opens a connection to QuickBooks. Must be called before beginning a session. ### Returns - None ``` -------------------------------- ### Create a Customer Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/QUICK-REFERENCE.md Uses the SessionManager to send a raw XML string to create a new customer record. ```python from qbdesktop import SessionManager with SessionManager("app_id", "MyApp", "path/to/company.qbw") as session: customer_xml = "John Doe" result = session.create_customer(customer_xml) ``` -------------------------------- ### Create Customer Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/quickbooks-session-manager.md Method signature for creating a customer using XML-formatted data. ```python def create_customer(self, customer_data: str) -> object: ``` -------------------------------- ### Initialize Element class Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/xml-building-classes.md Constructor for creating a single XML element. ```python Element(name: str, value: str, indent: int = 3) -> None ``` -------------------------------- ### Construct qbXML Elements Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/MODULE-INDEX.md Classes for building structured XML requests for QuickBooks. ```python Param(name: str, value: str) Element(name: str, value: str, indent: int = 3) Aggregate(name: str, elements: list[Element] = [], indent: int = 2, params: list[Param] = []) MessageAggregate(name: str, aggregates: list[Aggregate] = [], indent: int = 1, params: list[Param] = []) ``` -------------------------------- ### XML Construction Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/MODULE-INDEX.md Classes for building qbXML structures. ```APIDOC ## Param(name: str, value: str) Defines a parameter for an XML aggregate. ## Element(name: str, value: str, indent: int = 3) Defines an XML element. ## Aggregate(name: str, elements: list[Element] = [], indent: int = 2, params: list[Param] = []) Defines an XML aggregate structure. ## MessageAggregate(name: str, aggregates: list[Aggregate] = [], indent: int = 1, params: list[Param] = []) Defines a top-level message aggregate. ``` -------------------------------- ### Construct hierarchical XML requests Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/README.md Demonstrates building XML structures using Element and Aggregate classes before serializing them into a request string. ```python from qbdesktop import Element, Aggregate, MessageAggregate, Param # Build hierarchical XML name = Element("Name", "John Doe") email = Element("Email", "john@example.com") customer = Aggregate("Customer", elements=[name, email]) request = MessageAggregate("CustomerQueryRs", aggregates=[customer]) xml = request.read() ``` -------------------------------- ### Inheritance Hierarchy Visualization Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/MODULE-INDEX.md Displays the base class inheritance structure for qbXML elements. ```text qbXML ├── Element ├── Aggregate └── MessageAggregate ``` -------------------------------- ### Using Connection Context Managers Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/QUICK-REFERENCE.md Utilize context managers with RequestProcessor or SessionManager to ensure automatic opening, closing, beginning, and ending of sessions. ```python with ConnectionClass(...) as conn: # Connection is open result = conn.method() # Connection is automatically closed ``` -------------------------------- ### Define Module Constants Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/QUICK-REFERENCE.md Standard paths for company files and XML request storage. ```python DEFAULT_COMPANY_FILE = "C:\\Users\\Public\\Documents\\Intuit\\QuickBooks\\Company Files" REQUESTS_PATH = "./all_requests.xml" ``` -------------------------------- ### Query Customers Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/quickbooks-session-manager.md Method signature for retrieving all customer records from QuickBooks. ```python def query_customers(self) -> object: ``` -------------------------------- ### RequestProcessor Connection Class Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/QUICK-REFERENCE.md Handles low-level connection lifecycle and request processing for QuickBooks Desktop. ```python class RequestProcessor: def __init__(self, app_name: str) -> None def open_connection(self) -> None def close_connection(self) -> None def begin_session(self) -> None def end_session(self) -> None def process_request(self, request: str) -> str def __enter__(self) -> RequestProcessor def __exit__(self, exc_type, exc_val, exc_tb) -> None ``` -------------------------------- ### Execute a minimal QuickBooks request Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/README.md Uses the RequestProcessor context manager to handle connection and session lifecycle automatically while processing a raw XML request. ```python from qbdesktop import RequestProcessor, MessageAggregate # Open connection and session automatically with RequestProcessor("MyApp") as processor: # Build XML request msg = MessageAggregate("CustomerQueryRq") xml_request = msg.read() # Process request response_xml = processor.process_request(xml_request) print(response_xml) ``` -------------------------------- ### Param Constructor Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/xml-building-classes.md Constructor signature for creating a new Param instance representing an XML attribute. ```python Param(name: str, value: str) -> None ``` -------------------------------- ### RequestAllData Constructor Signature Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/request-all-data.md Constructor signature for initializing the RequestAllData instance. ```python RequestAllData(company_file_path: str, qb_file_mode: int) -> None ``` -------------------------------- ### Retrieve Web Connector Version Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/web-connector.md Fetches the version string from the QuickBooks Web Connector. ```python def get_version(self) -> str: ``` -------------------------------- ### create_customer(customer_data) Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/quickbooks-session-manager.md Creates a new customer in QuickBooks from XML-formatted customer data. ```APIDOC ## create_customer(customer_data) ### Description Creates a new customer in QuickBooks from XML-formatted customer data. Sends the request through the message set and returns customer details on success. ### Parameters - **customer_data** (str) - Required - Customer data in XML format ### Returns - **object** - Customer details from QuickBooks response ### Throws - **Exception** - Raised if response.StatusCode != 0 ``` -------------------------------- ### QuickBooksResponse(request, response) Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/quickbooks-response.md Initializes a new QuickBooksResponse instance, processes the XML response into a pandas DataFrame, and cleans up temporary files. ```APIDOC ## QuickBooksResponse(request, response) ### Description Initializes a QuickBooksResponse instance and converts the XML response to a pandas DataFrame. ### Parameters - **request** (str) - Optional - The original XML request string - **response** (str) - Optional - The XML response string from QuickBooks ### Usage Example ```python from qbdesktop import QuickBooksResponse response = QuickBooksResponse(request=request_xml, response=response_xml) print(response.dataframe) ``` ``` -------------------------------- ### Query All Customers Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/QUICK-REFERENCE.md Uses the SessionManager to establish a connection and retrieve all customer records. ```python from qbdesktop import SessionManager with SessionManager("app_id", "MyApp", "path/to/company.qbw") as session: customers = session.query_customers() ``` -------------------------------- ### process_request(request) Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/quickbooks-request-processor.md Sends an XML request to QuickBooks and returns the XML response. ```APIDOC ## process_request(request) ### Description Sends an XML request to QuickBooks and returns the XML response. Uses the internal ticket obtained from begin_session(). ### Parameters - **request** (str) - Required - XML request string to process ### Returns - **str** - The XML response from QuickBooks ``` -------------------------------- ### Connection Management Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/MODULE-INDEX.md Classes used to establish and manage connections to QuickBooks Desktop. ```APIDOC ## RequestProcessor(app_name: str) Initializes a request processor for the specified application. ## SessionManager(app_id: str, app_name: str, company_file_path: str) Manages a session with a specific QuickBooks company file. ## RequestProcessorDialog(app_id: str, app_name: str, company_file_path: str) Initializes a dialog-based request processor. ## WebConnector(url: str) Initializes a web connector instance for the given URL. ``` -------------------------------- ### Initialize Aggregate class Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/xml-building-classes.md Constructor for creating a container of XML elements. ```python Aggregate(name: str, elements: list[Element] = [], indent: int = 2, params: list[Param] = []) -> None ``` -------------------------------- ### Define Request Element Names Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/QUICK-REFERENCE.md String mappings for QuickBooks XML request query elements. ```python QBAgingRequest.BudgetSummary = "BudgetSummaryReportQueryRq" QBAgingRequest.CustomDetail = "CustomDetailReportQueryRq" QBAgingRequest.CustomSummary = "CustomSummaryReportQueryRq" QBAgingRequest.GeneralDetail = "GeneralDetailReportQueryRq" QBAgingRequest.GeneralSummary = "GeneralSummaryReportQueryRq" QBAgingRequest.Job = "JobReportQueryRq" QBAgingRequest.PayrollDetail = "PayrollDetailReportQueryRq" QBAgingRequest.PayrollSummary = "PayrollSummaryReportQueryRq" QBAgingRequest.Time = "TimeReportQueryRq" ``` -------------------------------- ### split_exe(input_file_path, output_folder, chunk_size_mb) Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/installer-utilities.md Splits a large binary file into multiple ZIP-compressed chunks. ```APIDOC ## split_exe(input_file_path, output_folder, chunk_size_mb) ### Description Splits a large binary file (such as the QB SDK installer) into multiple ZIP-compressed chunks. ### Parameters - **input_file_path** (str) - Required - Path to input file to split - **output_folder** (str) - Required - Folder where chunk files will be written - **chunk_size_mb** (int) - Optional (Default: 20) - Size of each chunk in megabytes ### Returns - **None** ``` -------------------------------- ### get_version() Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/web-connector.md Retrieves the version of the QuickBooks Web Connector. ```APIDOC ## get_version() ### Description Retrieves the version of the QuickBooks Web Connector. ### Returns - **str** - Version string from QBWebConnector ``` -------------------------------- ### Manage RequestProcessor resources with context managers Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/README.md Use the with statement to ensure automatic connection and session cleanup when interacting with the RequestProcessor. ```python with RequestProcessor("app") as rp: # Connection and session managed automatically response = rp.process_request(xml) ``` -------------------------------- ### Process Request Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/web-connector.md Sends an XML request string to QuickBooks and returns the XML response. ```python def process_request(self, ticket: str, str_request: str) -> str: ``` -------------------------------- ### query_customers() Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/quickbooks-session-manager.md Queries and retrieves all customers from QuickBooks. ```APIDOC ## query_customers() ### Description Queries and retrieves all customers from QuickBooks. Sends a customer query request and returns the customer details. ### Returns - **object** - Customer details from QuickBooks response ### Throws - **Exception** - Raised if response.StatusCode != 0 ``` -------------------------------- ### Check Operating System Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/configuration.md Verifies if the current environment is running on Windows, which is required for all QuickBooks functionality. ```python def is_windows(): return platform.system().lower() == 'windows' ``` -------------------------------- ### WebConnector Connection Class Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/QUICK-REFERENCE.md Handles web-based communication and ticket management for QuickBooks integration. ```python class WebConnector: def __init__(self, url: str) -> None def get_version(self) -> str def get_error(self) -> str def get_ticket(self) -> str def close(self, ticket: str) -> object def process_request(self, ticket: str, str_request: str) -> str def receive_response(self, ticket: str, response: str, hresult: int, message: str) -> bool def send_request(self, ticket: str, company_file_path: str, qb_file_mode: int, request: str) -> bool ``` -------------------------------- ### Check Windows OS Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/installer-utilities.md Verify if the current environment is running on Windows. ```python def is_windows() -> bool: ``` ```python return platform.system().lower() == 'windows' ``` -------------------------------- ### Enter Context Manager Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/quickbooks-request-processor.md Method invoked when entering a with block. ```python def __enter__(self) -> RequestProcessor: ``` -------------------------------- ### send_request() Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/request-all-data.md Sends a full synchronization request to QuickBooks and returns the response. ```APIDOC ## send_request() ### Description Sends a full synchronization request to QuickBooks and returns the response as a ResponseReader object. This request retrieves all data from the QuickBooks company file. ### Returns - **object** - QBXMLRP2.ResponseReader object containing the response ``` -------------------------------- ### Show XML Request Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/request-processor-dialog.md Method signature for displaying the request processor dialog with a specific XML request. ```python def show(self, xml_request: str) -> None: ``` -------------------------------- ### Send Custom XML Request Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/QUICK-REFERENCE.md Uses the RequestProcessor to send a custom XML request directly to QuickBooks. ```python from qbdesktop import RequestProcessor with RequestProcessor("MyApp") as processor: request = "" response = processor.process_request(request) print(response) ``` -------------------------------- ### send_request(ticket, company_file_path, qb_file_mode, request) Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/web-connector.md Sends a request to QuickBooks using the specified ticket number, company file path, QB file mode, and request XML string. ```APIDOC ## send_request(ticket, company_file_path, qb_file_mode, request) ### Description Sends a request to QuickBooks using the specified ticket number, company file path, QB file mode, and request XML string. Returns True if the request was sent successfully. ### Parameters - **ticket** (str) - Required - Session ticket identifier - **company_file_path** (str) - Required - Path to the QuickBooks company file - **qb_file_mode** (int) - Required - File mode for opening the company file - **request** (str) - Required - XML request string to send ### Returns - **bool** - True if request sent successfully, False otherwise ``` -------------------------------- ### show(xml_request) Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/request-processor-dialog.md Displays the request processor dialog with the specified XML request. ```APIDOC ## show(xml_request) ### Description Displays the request processor dialog with the specified XML request. The dialog will show the request to the user and allow interactive processing. ### Parameters - **xml_request** (str) - Required - XML request string to display and process ### Returns - None ``` -------------------------------- ### save_as_excel Method Signature Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/quickbooks-response.md Method signature for saving response data to an Excel file; currently a stub implementation. ```python def save_as_excel(self, filepath: str) -> None: ``` -------------------------------- ### RequestProcessor Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/MODULE-INDEX.md The RequestProcessor class handles the core communication with QuickBooks Desktop, including session management and request execution. ```APIDOC ## RequestProcessor ### Methods - `open_connection() -> None`: Opens a connection to QuickBooks. - `begin_session() -> None`: Starts a session with QuickBooks. - `process_request(request: str) -> str`: Sends an XML request string to QuickBooks and returns the response. - `end_session() -> None`: Ends the current session. - `close_connection() -> None`: Closes the connection to QuickBooks. ``` -------------------------------- ### SessionManager Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/QUICK-REFERENCE.md Manages a session with QuickBooks Desktop to perform queries. ```APIDOC ## SessionManager ### Description Manages the lifecycle of a QuickBooks session. Use the context manager to ensure proper session handling. ### Methods - **query_customers()**: Retrieves a list of customers from the QuickBooks company file. ``` -------------------------------- ### WebConnector Methods Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/web-connector.md Methods available on the WebConnector instance for managing QuickBooks Desktop web service communication. ```APIDOC ## WebConnector.get_version() ### Description Retrieves the version information of the QBWebConnector service. ## WebConnector.get_ticket() ### Description Obtains a session ticket required for subsequent requests. ## WebConnector.process_request(ticket, xml_request) ### Description Sends an XML request to the QuickBooks web service using the provided session ticket. ## WebConnector.receive_response(ticket, response, hresult, message) ### Description Acknowledges receipt of a response from the web service. ## WebConnector.close(ticket) ### Description Closes the active session associated with the provided ticket. ``` -------------------------------- ### is_windows() Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/installer-utilities.md Checks if the current system is running on Windows. ```APIDOC ## is_windows() ### Description Checks if the current system is running Windows. ### Signature `def is_windows() -> bool` ### Returns - **bool** - True if running on Windows, False otherwise ``` -------------------------------- ### Send Request Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/web-connector.md Sends a request to QuickBooks with specific company file path and mode parameters. ```python def send_request(self, ticket: str, company_file_path: str, qb_file_mode: int, request: str) -> bool: ``` -------------------------------- ### send_request Method Signature Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/request-all-data.md Method signature for sending a full synchronization request to QuickBooks. ```python def send_request(self) -> object: ``` -------------------------------- ### combine_chunks(input_folder, output_file) Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/installer-utilities.md Combines numbered ZIP chunk files back into the original binary file. ```APIDOC ## combine_chunks(input_folder, output_file) ### Description Combines numbered ZIP chunk files back into the original binary file. The function expects files in the format `{name}_part_{number}.zip`. ### Parameters - **input_folder** (str) - Required - Folder containing chunk ZIP files - **output_file** (str) - Required - Output path for combined file ### Returns - **None** ``` -------------------------------- ### Define qbXML Base Class Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/xml-building-classes.md The base marker class for the XML building hierarchy. ```python class qbXML: pass ``` -------------------------------- ### Handle QuickBooks Responses Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/MODULE-INDEX.md Class for processing and storing response data from QuickBooks. ```python QuickBooksResponse(request: str = None, response: str = None) ``` -------------------------------- ### Import RequestAllData Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/request-all-data.md Required import statement to access the RequestAllData class. ```python from qbdesktop import RequestAllData ``` -------------------------------- ### RequestAllData Connection Class Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/QUICK-REFERENCE.md Utility class for sending bulk data requests to a company file. ```python class RequestAllData: def __init__(self, company_file_path: str, qb_file_mode: int) -> None def send_request(self) -> object ``` -------------------------------- ### WebConnector Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/MODULE-INDEX.md The WebConnector class provides methods for interacting with the QuickBooks Web Connector service. ```APIDOC ## WebConnector ### Methods - `get_ticket() -> str`: Retrieves a session ticket. - `send_request(ticket: str, company_file_path: str, qb_file_mode: int, request: str) -> bool`: Sends a request to the Web Connector. - `receive_response(ticket: str, response: str, hresult: int, message: str) -> bool`: Receives a response from the Web Connector. - `close(ticket: str) -> object`: Closes the Web Connector session. ``` -------------------------------- ### Define QBAgingRequest constants Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/aging-and-job-reports.md Defines the structure of the QBAgingRequest class containing report query request element names. ```python @dataclass(slots=True) class QBAgingRequest: BudgetSummary = "BudgetSummaryReportQueryRq" CustomDetail = "CustomDetailReportQueryRq" CustomSummary = "CustomSummaryReportQueryRq" GeneralDetail = "GeneralDetailReportQueryRq" GeneralSummary = "GeneralSummaryReportQueryRq" Job = "JobReportQueryRq" PayrollDetail = "PayrollDetailReportQueryRq" PayrollSummary = "PayrollSummaryReportQueryRq" Time = "TimeReportQueryRq" ``` -------------------------------- ### RequestProcessor Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/README.md The RequestProcessor class provides a direct interface to the QBXMLRP2 COM object, supporting context management and raw request processing. ```APIDOC ## RequestProcessor ### Description Direct QBXMLRP2 interface for processing raw XML requests with automatic session lifecycle management. ### Methods - **process_request(xml_request)**: Sends a raw QBXML string to QuickBooks and returns the response XML. ``` -------------------------------- ### Build XML Programmatically Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/QUICK-REFERENCE.md Uses library classes to construct XML structures without manual string concatenation. ```python from qbdesktop import Element, Aggregate, MessageAggregate # Leaf elements name = Element("Name", "John Doe") email = Element("Email", "john@example.com") # Container customer = Aggregate("Customer", elements=[name, email]) # Message root message = MessageAggregate("CustomerQueryRs", aggregates=[customer]) # Convert to XML string xml = message.read() ``` -------------------------------- ### process_request(ticket, str_request) Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/web-connector.md Sends a request to QuickBooks using the specified ticket number and request XML string. ```APIDOC ## process_request(ticket, str_request) ### Description Sends a request to QuickBooks using the specified ticket number and request XML string. Returns the response from QuickBooks. ### Parameters - **ticket** (str) - Required - Session ticket identifier - **str_request** (str) - Required - XML request string to send ### Returns - **str** - XML response from QuickBooks ``` -------------------------------- ### Defining QBJobReport Dataclass Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/aging-and-job-reports.md The dataclass structure defining integer constants for job report types. ```python @dataclass(slots=True) class QBJobReport: ItemEstimatesVsActuals = 0 ``` -------------------------------- ### RequestProcessorDialog Connection Class Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/QUICK-REFERENCE.md Provides a dialog-based interface for processing XML requests. ```python class RequestProcessorDialog: def __init__(self, app_id: str, app_name: str, company_file_path: str) -> None def show(self, xml_request: str) -> None def is_done(self) -> bool def get_response(self) -> str def close(self) -> None ``` -------------------------------- ### Initialize MessageAggregate Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/xml-building-classes.md Constructor definition for creating a new MessageAggregate instance. ```python MessageAggregate(name: str, aggregates: list[Aggregate] = [], indent: int = 1, params: list[Param] = []) -> None ``` -------------------------------- ### Retrieve WebConnector Errors Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/QUICK-REFERENCE.md Check for errors after initializing the WebConnector instance. ```python connector = WebConnector(url) error = connector.get_error() if error: print(f"Error: {error}") version = connector.get_version() print(f"Version: {version}") ``` -------------------------------- ### Split binary files into ZIP chunks Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/installer-utilities.md Splits a large binary file into multiple ZIP-compressed chunks of a specified size. Requires the input file to exist and will create the output folder if it does not. ```python def split_exe( input_file_path: str, output_folder: str, chunk_size_mb: int = 20 ) -> None: ``` -------------------------------- ### Manage QuickBooks sessions Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/README.md Utilizes the SessionManager to perform entity-based operations like querying and creating customers within a specific company file. ```python from qbdesktop import SessionManager with SessionManager("app_id", "MyApp", "path/to/company.qbw") as session: # Query customers customers = session.query_customers() # Create new customer customer_xml = "Jane" result = session.create_customer(customer_xml) ``` -------------------------------- ### SessionManager Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/README.md The SessionManager class provides high-level entity-based operations for interacting with QuickBooks company files. ```APIDOC ## SessionManager ### Description Provides entity-based operations including customer management and automatic XML message set creation. ### Methods - **query_customers()**: Retrieves customer data from the company file. - **create_customer(customer_xml)**: Creates a new customer using the provided XML string. ``` -------------------------------- ### Define Temporary File Path Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/configuration.md Sets the path for a temporary XML file within the current working directory for response processing. ```python self._path = os.path.join(os.getcwd(), "temp1.xml") ``` -------------------------------- ### RequestProcessorDialog Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/QUICK-REFERENCE.md Handles the execution of XML requests via a dialog interface. ```APIDOC ## RequestProcessorDialog ### Description Processes XML requests through a UI dialog. Provides methods to track completion and retrieve the resulting response. ### Methods - **show(xml)**: Displays the dialog and initiates processing of the provided XML. - **is_done()**: Returns a boolean indicating if the request processing is complete. - **get_response()**: Returns the response data after processing is finished. ``` -------------------------------- ### read() Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/api-reference/xml-building-classes.md Generates and returns the complete XML representation of the MessageAggregate. ```APIDOC ## read() ### Description Returns the complete MessageAggregate as a formatted XML string, including all nested aggregates. ### Returns - **str** - Formatted XML message string with nested aggregates ``` -------------------------------- ### Convert Response to DataFrame Source: https://github.com/donny-gui/quickbooks-desktop-python/blob/main/_autodocs/QUICK-REFERENCE.md Uses QuickBooksResponse to parse XML output into a pandas DataFrame. ```python from qbdesktop import QuickBooksResponse, RequestProcessor with RequestProcessor("MyApp") as processor: response_xml = processor.process_request("") response = QuickBooksResponse( request="", response=response_xml ) # Access as pandas DataFrame df = response.dataframe print(df.head()) ```