Skip to content

Brand07/PyFreshService

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyFreshService

A Python application for interacting with the FreshService API, featuring both a programmatic interface and a GUI for creating tickets and managing requesters.

image

Features

  • FreshService API Integration: Complete Python wrapper for FreshService ticket management
  • GUI Application: User-friendly interface built with CustomTkinter for creating tickets
  • Requester Management: Fetch and manage FreshService requesters
  • Ticket Creation: Create incidents and service requests with customizable fields
  • Environment Configuration: Secure API key management using environment variables

Installation

Prerequisites

  • Python 3.13 or higher
  • FreshService API access with valid API key

Setup

  1. Clone the repository:
git clone https://github.com/Brand07/PyFreshService.git
cd PyFreshService
  1. Install dependencies using uv (recommended) or pip:
# Using uv
uv sync

# Or using pip
pip install -r requirements.txt
  1. Create a .env file in the project root with your FreshService credentials:
API_KEY=your_freshservice_api_key
API_URL=https://your-domain.freshservice.com/api/v2
REQUESTER_URL=https://your-domain.freshservice.com/api/v2/requesters
REQUESTER_ID=your_default_requester_id
RESPONDER_ID=your_default_responder_id
GROUP_ID=your_default_group_id

Usage

GUI Application

Launch the graphical interface for easy ticket creation:

python ui.py

The GUI provides:

  • Dropdown menus for ticket types, priorities, and services
  • Email/requester selection
  • Rich text description input
  • One-click ticket creation

Programmatic Usage

Basic API Usage

from fresh import FreshServiceAPI
import os

# Initialize the API client
api = FreshServiceAPI(
    ticket_api_url=os.getenv("API_URL"),
    requesters_api_url=os.getenv("REQUESTER_URL"),
    api_key=os.getenv("API_KEY")
)

# Create a ticket
ticket = api.create_ticket(
    subject="Network connectivity issue",
    description="User cannot access shared drives",
    email="user@company.com",
    priority=3,  # High priority
    type="Incident",
    category="Network"
)

Fetch Requesters

# Get all requesters and save to JSON
requesters = api.get_requesters(output_file="requesters.json")

Project Structure

PyFreshService/
├── fresh.py              # Core FreshService API wrapper
├── ui.py                 # GUI application using CustomTkinter
├── requesters.json       # Cached requester data
├── pyproject.toml        # Project dependencies and metadata
├── .env                  # Environment variables (create this)
├── UI_Files/             # GUI configuration files
│   ├── window.json
│   ├── v2.json
│   └── updated_window.json
└── README.md            # This file

Dependencies

  • requests: HTTP library for API calls
  • customtkinter: Modern GUI framework
  • ctkmessagebox: Message boxes for the GUI
  • python-dotenv: Environment variable management
  • pillow: Image processing support
  • tomli: TOML file parsing

Configuration

Environment Variables

Variable Description Required
API_KEY Your FreshService API key Yes
API_URL FreshService API base URL Yes
REQUESTER_URL FreshService requesters endpoint Yes
REQUESTER_ID Default requester ID for bulk operations No
RESPONDER_ID Default responder ID No
GROUP_ID Default group ID for ticket assignment No

Ticket Priorities

  • 1: Low
  • 2: Medium
  • 3: High
  • 4: Urgent

Ticket Statuses

  • 2: Open
  • 3: Pending
  • 4: Resolved
  • 5: Closed

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

Support

For support or questions, please open an issue on the GitHub repository.

Changelog

v0.1.0

  • Initial release
  • Core FreshService API integration
  • GUI application for ticket creation
  • Requester management features

About

A simple application to create tickets in FreshService using the official API

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages