Python Redmine Library

2.5.0 · active · verified Fri Apr 17

Python-Redmine is a comprehensive library for programmatic interaction with the Redmine project management application. It allows users to manage issues, projects, users, and other Redmine resources through a Pythonic interface. The current version is 2.5.0, with new releases typically coming a few times a year, often including support for RedmineUP's Pro Edition plugins.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart connects to a Redmine instance using an API key, fetches information about the current user, lists the first five projects, and attempts to retrieve a specific issue by ID. Ensure you have your Redmine URL and API key configured.

import os
from redminelib import Redmine
from redminelib.exceptions import ResourceNotFoundError

# Replace with your Redmine URL and API Key
REDMINE_URL = os.environ.get('REDMINE_URL', 'http://localhost:3000')
REDMINE_API_KEY = os.environ.get('REDMINE_API_KEY', 'YOUR_API_KEY_HERE')

try:
    redmine = Redmine(REDMINE_URL, key=REDMINE_API_KEY)
    
    # Get current user
    me = redmine.user.get('current')
    print(f"Connected to Redmine as: {me.firstname} {me.lastname} ({me.login})")

    # Get a list of projects
    projects = redmine.project.all(limit=5)
    print("\nFirst 5 Projects:")
    for project in projects:
        print(f" - {project.name} (ID: {project.id})")
        
    # Try to get a specific issue
    try:
        issue = redmine.issue.get(1)
        print(f"\nIssue #1: {issue.subject} (Status: {issue.status.name})")
    except ResourceNotFoundError:
        print("\nIssue #1 not found.")

except Exception as e:
    print(f"An error occurred: {e}")

view raw JSON →