# PyJotformAJM

## Overview
PyJotformAJM is a Python application designed to interface with JotForm's API, allowing users to manage and retrieve form submissions efficiently. It features classes for handling various authentication errors, client initialization, and form data processing.

## Features
- **Error Handling:** Custom classes `JotFormAuthenticationError` and `NoJotformClientError` for managing authentication-related issues.
- **JotForm Client Class:** The `JotForm` class manages form submissions, client validation, and other form-related operations.

## Requirements
- Python 3.12.2
- pip (Python package installer)

## Installation

1. Clone the repository:
    ```bash
    git clone https://github.com/amcsparron2793-Water/pyjotformajm.git
    cd pyjotformajm
    ```

2. Create a virtual environment and activate it:
    ```bash
    python -m venv venv
    .\venv\Scripts\activate  # On Windows
    # source venv/bin/activate  # On macOS/Linux
    ```

3. Install the required packages:
    ```bash
    pip install -r requirements.txt
    ```

## Usage
To use the PyJotformAJM application, follow the steps below:

1. Initialize the `JotForm` class with your credentials and form ID.
2. Use the various methods provided by the `JotForm` class to interact with your form data.

### Example
```python
from PyJotformAJM import JotForm

# Initialize JotForm client
jotform = JotForm(client_id='YOUR_CLIENT_ID', client_secret='YOUR_CLIENT_SECRET', form_id='YOUR_FORM_ID')

# Check for new entries
if jotform.has_new_entries():
    new_entries = jotform.get_new_submissions()
    print(new_entries)
```

## Classes and Methods

### JotForm

- **Attributes:**
  - `DEFAULT_FORM_ID`
  - `ILLEGAL_STARTING_CHARACTERS`
  - `IGNORED_FIELD_MESSAGE`
  - `has_valid_client`
  - `logger`
  - `_last_submission_id`
  - `_real_jf_field_names`
  - `form_id`
  - `client`
  - `_new_entries_total`
  - `_form_section_headers`
  - `_has_new_entries`
  - `ignored_submission_fields`
  - `_has_valid_client`

- **Methods:**
  - `__init__(self, client_id: str, client_secret: str, form_id: str)`
  - `real_jf_field_names(self)`
  - `form_section_headers(self)`
  - `has_new_entries(self)`
  - `new_entries_total(self)`
  - `last_submission_id(self)`
  - `has_valid_client(self)`
  - `_initialize_client(self)`
  - `_validate_client(self)`
  - `_get_last_submission_id(self)`
  - `get_new_submissions(self)`
  - `_strip_answer(self, answer: dict)`
  - `_get_answers_dict(self, answer: dict)`
  - `get_answers_from_submission(self, submission: dict)`
  - `is_illegal_field(self, field_name: str)`

## Contributing
1. Fork the repository.
2. Create a new branch: `git checkout -b my-feature-branch`
3. Make your changes and commit them: `git commit -m 'Add some feature'`
4. Push to the branch: `git push origin my-feature-branch`
5. Submit a pull request.

## License
This project is under the MIT License - see the [LICENSE](LICENSE.txt) file for details.



---

*Generated by AI Assistant*