PyBacklogPy
PyBacklogPy is a Python client library designed for interacting with the Backlog API v2. The library is currently at version 0.12. However, its official GitHub repository was archived on October 31, 2024, rendering it read-only and indicating that the library is no longer actively maintained or receiving updates.
Warnings
- breaking The official GitHub repository for PyBacklogPy (kitadakyou/PyBacklogPy) was archived on October 31, 2024. This means the project is no longer actively maintained, and no further updates, bug fixes, or new features will be released. Users should be aware of potential unpatched issues or compatibility problems with future Python versions or Backlog API changes.
- gotcha When handling file downloads, the API methods return a tuple containing the file path and the raw response object (e.g., `(file_path, response_object)`). Incorrectly assuming only the file content or path is returned can lead to errors.
- gotcha Authentication can be configured either via a `secrets` file in the project root or programmatically by passing `space_id` and `api_key` to `BacklogConfigure`. If both are present, programmatic configuration takes precedence. Ensure sensitive credentials are not hardcoded in source control.
Install
-
pip install pybacklogpy
Imports
- BacklogConfigure
from pybacklogpy.BacklogConfigure import BacklogConfigure
- Issue
from pybacklogpy.Issue import Issue
- Project
from pybacklogpy.Project import Project
Quickstart
import os
from pybacklogpy.BacklogConfigure import BacklogConfigure
from pybacklogpy.Issue import Issue
# Configure API access using environment variables
space_id = os.environ.get('BACKLOG_SPACE_ID', 'your_backlog_space_id')
api_key = os.environ.get('BACKLOG_API_KEY', 'your_backlog_api_key')
if space_id == 'your_backlog_space_id' or api_key == 'your_backlog_api_key':
print("Please set BACKLOG_SPACE_ID and BACKLOG_API_KEY environment variables or replace placeholders.")
else:
config = BacklogConfigure(space_id=space_id, api_key=api_key)
# Example: Initialize Issue API client
issue_api = Issue(config)
# Example: Try to get a list of issues (this might require project_id_or_key)
# Note: Replace 'PROJECT_KEY' with an actual project key in your Backlog instance
try:
# Attempt to fetch issues. This often requires a project or other filters.
# For simplicity, this example just attempts to call a method.
# A real-world use case would involve valid parameters.
# print("Attempting to get issues...")
# response = issue_api.get_issue_list(project_id_or_key='PROJECT_KEY')
# if response.ok:
# print("Successfully connected to Backlog API.")
# print(f"First 5 issues: {response.json()[:5]}")
# else:
# print(f"Error connecting to Backlog API: {response.status_code} - {response.text}")
print("PyBacklogPy configured successfully. You can now use 'issue_api' for calls.")
except Exception as e:
print(f"An error occurred during API call setup: {e}")