Trello Extract is a Python project that uses the py-trello library and python-dotenv to authenticate with the Trello API and fetch details from Trello boards, lists, and cards. This project demonstrates how to securely manage API credentials and interact with Trello's API to retrieve project data for further processing.
Project description
AI Trello Extract
Trello Extract is a Python project that uses the py-trello library and python-dotenv to authenticate with the Trello API and fetch details from Trello boards, lists, and cards. This project demonstrates how to securely manage API credentials and interact with Trello's API to retrieve project data for further processing.
Features
- Authenticate with the Trello API using OAuth.
- Fetch details of all accessible Trello boards.
- Retrieve lists and cards from a specified Trello board.
- Securely manage API credentials using environment variables.
Install through PyPI
pip install ai-trello-extract
For more details, visit the PyPI project page.
Setup
1: Register for Trello API Access
-
Sign Up for a Trello Account:
- If you don't have a Trello account, sign up at Trello.
-
Get API Key and Token:
- Go to the Trello Developer Portal.
- Copy your API Key.
- Click on the "Token" link to generate a token. This token will be used for authentication in your API requests.
2. Clone the repository:
git clone https://github.com/DEV3L/ai-trello-extract
cd ai-trello-extract
Copy the env.local file to a new file named .env and replace the placeholder environment variables with your actual Trello API key:
cp env.default .env
Environment Variables
The following environment variables can be configured in the .env
file:
TRELLO_API_KEY
: The Trello API keyTRELLO_API_TOKEN
: The Trello API tokenTRELLO_BOARD_NAME
: The Trello board nameOUTPUT_DIRECTORY
: The output directory
3. Setup a virtual environment with dependencies and activate it:
brew install hatch
hatch env create
hatch shell
Usage
The trello_integration.py
script will:
- Authenticate with the Trello API using the credentials provided in the
.env
file. - Fetch and print the details of all accessible Trello boards.
- Fetch and print the lists and cards from the first Trello board in the list.
Testing
End to End Test
hatch run e2e
Unit Tests
hatch run test
Coverage Gutters:
Command + Shift + P => Coverage Gutters: Watch
Example
Example Trello Board: AI Trello Extract Example
Example Program
from loguru import logger
from ai_trello_extract.clients.trello_client import get_trello_client
from ai_trello_extract.env_variables import ENV_VARIABLES, set_env_variables
from ai_trello_extract.orchestrators.orchestration_service import OrchestrationService
from ai_trello_extract.services.trello_service import TrelloService
def main():
orchestration_service = OrchestrationService(
TrelloService(get_trello_client(ENV_VARIABLES.trello_api_key, ENV_VARIABLES.trello_api_token))
)
try:
markdown_file_name = orchestration_service.write_board_markdown_to_file(
ENV_VARIABLES.trello_board_name, ENV_VARIABLES.output_directory
)
logger.info(f"Markdown file written to {markdown_file_name}")
except RuntimeError as e:
logger.error(e)
if __name__ == "__main__":
set_env_variables()
main()
Example Output
# BACKLOG
This is a list of cards, work items, user stories, and tasks that are in the backlog category.
## Title: Integrate into other projects
## List Name: Backlog
## Labels
- Future
# TODO
This is a list of cards, work items, user stories, and tasks that are in the todo category.
## Title: Test and Make Sure It Works
## List Name: Todo
## Labels
- Testing
## Description
Need to verify the code works as planned
# DOING
This is a list of cards, work items, user stories, and tasks that are in the doing category.
## Title: Upload to PyPI
## List Name: Doing
## Labels
- Code
# DONE
This is a list of cards, work items, user stories, and tasks that are in the done category.
## Title: Make new project
## List Name: Done
## Labels
- Code
## Description
Create the project for uploading to PyPI
### Comments
Use existing ai-assistant-manager project as a base
Contributing
We welcome contributions! To contribute:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Make your changes.
- Ensure all tests pass.
- Submit a pull request with a detailed description of your changes.
Code of Conduct
We expect all contributors to adhere to our Code of Conduct:
- Be respectful and considerate.
- Avoid discriminatory or offensive language.
- Report any unacceptable behavior to the project maintainers.
By participating in this project, you agree to abide by these guidelines.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for ai_trello_extract-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 368e3ef4a39350f7f212ec093acd51c206a96ef22144d9e09ae2e33f33ffd2fd |
|
MD5 | 54cbc0bd6747ab3af10d9354fe02c86d |
|
BLAKE2b-256 | 3acf48977e11658090daa9658bf2ff9d56f13ecedf83634a97ee3481a617fce2 |