Skip to content

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_keyAPI_URL=https://your-domain.freshservice.com/api/v2REQUESTER_URL=https://your-domain.freshservice.com/api/v2/requestersREQUESTER_ID=your_default_requester_idRESPONDER_ID=your_default_responder_idGROUP_ID=your_default_group_idDOMAIN=your_freshservice_domainEMAIL_DOMAIN=your_domain_nameLOCATION=your_region_location

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

fromfreshimportFreshServiceAPIimportos# Initialize the API clientapi=FreshServiceAPI(
ticket_api_url=os.getenv("API_URL"),
requesters_api_url=os.getenv("REQUESTER_URL"),
api_key=os.getenv("API_KEY")
)
# Create a ticketticket=api.create_ticket(
subject="Network connectivity issue",
description="User cannot access shared drives",
email="user@company.com",
priority=3, # High prioritytype="Incident",
category="Network"
)

Fetch Requesters

# Get all requesters and save to JSONrequesters=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

VariableDescriptionRequired
API_KEYYour FreshService API keyYes
API_URLFreshService API base URLYes
REQUESTER_URLFreshService requesters endpointYes
REQUESTER_IDDefault requester ID for bulk operationsNo
RESPONDER_IDDefault responder IDNo
GROUP_IDDefault group ID for ticket assignmentNo

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

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages