50 Commits

Author SHA1 Message Date
Sam Chau
f1ae021aef fix: Update legacy Sonarr quality profiles with Bluray-576p 2024-11-02 11:56:33 +10:30
Sam Chau
8be921cab9 fix: add support for "minUpgradeFormatScore" to sonarr profiles 2024-09-23 22:23:24 +09:30
Sam Chau
4364d940ec fix: add support for "minUpgradeFormatScore" to radarr profiles 2024-09-23 22:21:38 +09:30
santiagosayshey
d4dc3b6c2d workflow: added back workflow to add to testing 2024-06-28 09:48:08 +09:30
santiagosayshey
3c88841cb0 Merge branch 'main' of https://github.com/Dictionarry-Hub/profilarr 2024-06-28 09:38:43 +09:30
santiagosayshey
c081d7d7a4 removed: testing and complete workflows 2024-06-28 09:38:35 +09:30
Sam Chau
48e72bd55d test: test (#92) 2024-06-28 09:31:28 +09:30
santiagosayshey
3acc743b98 bugfix: Correct handling of environment variables for updating issue status 2024-06-28 09:29:48 +09:30
Sam Chau
fe49baf402 test: test (#91) 2024-06-28 09:26:31 +09:30
Sam Chau
4090e5e3b9 bugfix: remove test line from README (#90) 2024-06-28 09:24:03 +09:30
santiagosayshey
0ec65299ef workflow: Set issues status to "Complete" on merge to main 2024-06-28 09:20:43 +09:30
santiagosayshey
3edeb14f14 Merge branch 'main' of https://github.com/Dictionarry-Hub/profilarr 2024-06-28 09:19:52 +09:30
santiagosayshey
a4160941af workflow: changed to dev for real development 2024-06-28 09:19:45 +09:30
Sam Chau
cafc0ed796 Update README.md (#89) 2024-06-28 09:14:37 +09:30
santiagosayshey
14d2c288d4 workflow: adjusted to main for testing 2024-06-28 09:10:02 +09:30
santiagosayshey
515e52dcfa workflow: Set issue status to "Testing" on merge to dev 2024-06-28 09:09:06 +09:30
santiagosayshey
e471edd96f bugfix: Correct dynamic retrieval of field and option IDs for setting issue status 2024-06-28 09:01:10 +09:30
santiagosayshey
17f623a805 bugfix: Correct environment variable usage and syntax in workflow 2024-06-28 08:56:59 +09:30
santiagosayshey
7badb36616 bugfix: Correct environment variable usage and syntax in workflow 2024-06-28 08:54:18 +09:30
santiagosayshey
22602f24e9 bugfix: Correct environment variable usage and syntax in workflow 2024-06-28 08:50:53 +09:30
santiagosayshey
fdc4edbf90 bugfix: Adjusted the GitHub Actions workflow to trigger on branch creation and corrected the GraphQL query. 2024-06-28 08:43:48 +09:30
santiagosayshey
175459139a bugfix: Enhanced debugging for the GitHub Actions workflow to identify issues in fetching project item IDs. 2024-06-28 08:41:30 +09:30
santiagosayshey
b4522aeefa bugfix: Fixed the GraphQL query in GitHub Actions workflow to properly use the declared variable for fetching the project item ID. 2024-06-28 08:39:59 +09:30
santiagosayshey
61a363ff93 workflow: Added workflow to update issue status to 'In Development' when branches are created from issues 2024-06-28 08:38:10 +09:30
santiagosayshey
527e415d18 bugfix: Correct issue number extraction and project item status update 2024-06-28 08:29:33 +09:30
santiagosayshey
757a7522e3 bugfix: Correct issue number extraction and project item status update 2024-06-28 08:28:01 +09:30
santiagosayshey
4b67031e78 bigfix: tab syntax fixed 2024-06-28 08:21:58 +09:30
santiagosayshey
0e772ecf38 bugfix: Correct issue number handling and status update 2024-06-28 08:19:24 +09:30
santiagosayshey
5f58fc63b0 bugfix: Correct issue number handling and status update 2024-06-28 08:17:16 +09:30
santiagosayshey
1f0247dd78 feature: Set issue status to "In Development" on branch creation 2024-06-28 08:14:44 +09:30
santiagosayshey
b9079a5f3d bugfix: remove timer 2024-06-28 08:03:41 +09:30
santiagosayshey
72fb763c17 bugfix: Fix issue type assignment based on issue label case sensitivity 2024-06-28 08:00:26 +09:30
santiagosayshey
f66f2a160a bugfix: fixed jq 2024-06-28 07:57:25 +09:30
santiagosayshey
ca32c2cc89 bugfix: debug output to see where issue lies 2024-06-28 07:54:55 +09:30
santiagosayshey
1b58c1e0aa bugfix: add sleep before finding ID number 2024-06-28 07:51:01 +09:30
santiagosayshey
0ad40005b4 bugfix: Correct project item ID retrieval in GitHub Actions workflow 2024-06-28 07:48:26 +09:30
santiagosayshey
da1be0ef36 bugfix: Resolve project item ID retrieval in GitHub Actions workflow 2024-06-28 07:46:15 +09:30
santiagosayshey
e9d62a9b4a bugfix: get issue ID after item creation 2024-06-28 07:43:07 +09:30
santiagosayshey
bd21eef647 workflows: project PAT added 2024-06-28 07:39:35 +09:30
Sam Chau
7bb2e255dd workflow: add issue to project (#77) 2024-06-28 07:35:43 +09:30
Sam Chau
bd89fd9126 Update README.md (#74) 2024-06-21 04:52:04 +09:30
santiagosayshey
3c110fee42 Add CODEOWNERS file to require code review 2024-05-07 03:57:03 +09:30
santiagosayshey
015553205a Update README.md to be user friendly 2024-03-10 03:45:50 +10:30
santiagosayshey
1b038711f4 Update README.md 2024-03-10 03:36:40 +10:30
santiagosayshey
e221004add Update README.md 2024-03-10 03:35:06 +10:30
santiagosayshey
1dab721756 Update README.md 2024-03-10 03:34:54 +10:30
santiagosayshey
08a95035c5 Update README.md 2024-03-09 09:55:21 +10:30
santiagosayshey
840861b24c Update README.md 2024-03-08 09:26:13 +10:30
santiagosayshey
9ff99d556b Update setup.py
Closes #33
2024-02-13 17:44:36 +10:30
santiagosayshey
a82e8d31fe ANSI Escape colors not being printed properly (#34)
* Added config setting to allow ansi coloring
* Adjusted README for configuring ansi support
2024-02-08 08:44:01 +10:30
29 changed files with 22391 additions and 21827 deletions

1
.github/CODEOWNERS vendored Normal file
View File

@@ -0,0 +1 @@
* @santiagosayshey

View File

@@ -0,0 +1,133 @@
name: Add Issue to Project
on:
issues:
types: [opened]
jobs:
add-to-project:
name: Add issue to project
runs-on: ubuntu-latest
steps:
- name: Add to Project
id: add-to-project
uses: actions/add-to-project@v0.5.0
with:
project-url: https://github.com/orgs/Dictionarry-Hub/projects/1
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
- name: Get project item ID
id: get-project-item-id
env:
GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_PAT }}
PROJECT_ID: "PVT_kwDOCjbMFM4AjuUh"
ISSUE_NUMBER: ${{ github.event.issue.number }}
run: |
echo "Fetching project item ID for issue number: $ISSUE_NUMBER"
item_id=$(gh api graphql -f query='
query($project:ID!) {
node(id: $project) {
... on ProjectV2 {
items(first: 100) {
nodes {
id
content {
... on Issue {
number
}
}
}
}
}
}
}' -f project=$PROJECT_ID --jq ".data.node.items.nodes[] | select(.content.number == $ISSUE_NUMBER) | .id" -F number=$ISSUE_NUMBER)
if [ -z "$item_id" ]; then
echo "Error: Project item ID not found for issue number $ISSUE_NUMBER"
exit 1
else
echo "Project item ID found: $item_id"
echo "PROJECT_ITEM_ID=$item_id" >> $GITHUB_OUTPUT
fi
- name: Set component, type, and status
env:
GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_PAT }}
PROJECT_ITEM_ID: ${{ steps.get-project-item-id.outputs.PROJECT_ITEM_ID }}
run: |
echo "Setting fields for Project Item ID: ${PROJECT_ITEM_ID}"
# Set component to "Profilarr"
result=$(gh api graphql -f query='
mutation($project:ID!, $item:ID!, $fieldId:ID!, $value:String!) {
updateProjectV2ItemFieldValue(input: {
projectId: $project
itemId: $item
fieldId: $fieldId
value: {
singleSelectOptionId: $value
}
}) {
projectV2Item {
id
}
}
}' -f project="PVT_kwDOCjbMFM4AjuUh" -f item="${PROJECT_ITEM_ID}" -f fieldId="PVTSSF_lADOCjbMFM4AjuUhzgcCr_E" -f value="48fc49c7")
echo "Set component result: $result"
# Set status to "Backlog"
result=$(gh api graphql -f query='
mutation($project:ID!, $item:ID!, $fieldId:ID!, $value:String!) {
updateProjectV2ItemFieldValue(input: {
projectId: $project
itemId: $item
fieldId: $fieldId
value: {
singleSelectOptionId: $value
}
}) {
projectV2Item {
id
}
}
}' -f project="PVT_kwDOCjbMFM4AjuUh" -f item="${PROJECT_ITEM_ID}" -f fieldId="PVTSSF_lADOCjbMFM4AjuUhzgcCn8s" -f value="f75ad846")
echo "Set status result: $result"
# Get the label of the issue
LABEL=$(gh api repos/${{ github.repository }}/issues/${{ github.event.issue.number }} --jq '.labels[0].name')
echo "Issue label: $LABEL"
# Convert label to lowercase for comparison
LABEL_LOWER=$(echo "$LABEL" | tr '[:upper:]' '[:lower:]')
# Set issue type based on label
ISSUE_TYPE_ID=$(case $LABEL_LOWER in
"bug") echo "b760225f" ;;
"feature request") echo "1341bde2" ;;
"improvement") echo "cb34d96f" ;;
"documentation") echo "269885d0" ;;
"refactor") echo "4996f537" ;;
"infrastructure") echo "45a91bfe" ;;
*) echo "" ;;
esac)
if [ -z "$ISSUE_TYPE_ID" ]; then
echo "No matching issue type for label: $LABEL"
else
echo "Setting issue type to ID: $ISSUE_TYPE_ID"
result=$(gh api graphql -f query='
mutation($project:ID!, $item:ID!, $fieldId:ID!, $value:String!) {
updateProjectV2ItemFieldValue(input: {
projectId: $project
itemId: $item
fieldId: $fieldId
value: {
singleSelectOptionId: $value
}
}) {
projectV2Item {
id
}
}
}' -f project="PVT_kwDOCjbMFM4AjuUh" -f item="${PROJECT_ITEM_ID}" -f fieldId="PVTSSF_lADOCjbMFM4AjuUhzgcCswQ" -f value="$ISSUE_TYPE_ID")
echo "Set issue type result: $result"
fi

117
.github/workflows/add-to-testing.yml vendored Normal file
View File

@@ -0,0 +1,117 @@
name: Set Issue Status to Testing on Merge to Dev
on:
pull_request:
branches:
- dev
types:
- closed
jobs:
update-status:
if: ${{ github.event.pull_request.merged }}
runs-on: ubuntu-latest
steps:
- name: Extract Issue Number from Branch Name
id: extract-issue-number
run: |
ISSUE_NUMBER=$(echo ${{ github.event.pull_request.head.ref }} | cut -d'-' -f1)
echo "Issue Number extracted: $ISSUE_NUMBER"
echo "ISSUE_NUMBER=$ISSUE_NUMBER" >> $GITHUB_ENV
- name: Get project item ID
id: get-project-item-id
env:
GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_PAT }}
PROJECT_ID: "PVT_kwDOCjbMFM4AjuUh"
run: |
echo "Fetching project item ID for issue number: $ISSUE_NUMBER"
QUERY='
query fetchProjectItem($project: ID!) {
node(id: $project) {
... on ProjectV2 {
items(first: 100) {
nodes {
id
content {
... on Issue {
number
}
}
}
}
}
}
}'
item_id=$(gh api graphql -f query="$QUERY" -f project=$PROJECT_ID --jq '.data.node.items.nodes[] | select(.content.number == '"$ISSUE_NUMBER"') | .id')
if [ -z "$item_id" ]; then
echo "Error: Project item ID not found for issue number $ISSUE_NUMBER"
exit 1
else
echo "Project item ID found: $item_id"
echo "PROJECT_ITEM_ID=$item_id" >> $GITHUB_ENV
fi
- name: Get single select field ID and options
id: get-field-options
env:
GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_PAT }}
PROJECT_ID: "PVT_kwDOCjbMFM4AjuUh"
run: |
echo "Fetching field ID and options for status"
QUERY='
query($project:ID!) {
node(id: $project) {
... on ProjectV2 {
fields(first: 100) {
nodes {
... on ProjectV2SingleSelectField {
id
name
options {
id
name
}
}
}
}
}
}
}'
field_data=$(gh api graphql -f query="$QUERY" -f project=$PROJECT_ID --jq '.data.node.fields.nodes[] | select(.name == "Status")')
field_id=$(echo $field_data | jq -r '.id')
testing_option_id=$(echo $field_data | jq -r '.options[] | select(.name == "Testing") | .id')
if [ -z "$field_id" ] || [ -z "$testing_option_id" ]; then
echo "Error: Field ID or Testing option ID not found"
exit 1
else
echo "Field ID: $field_id"
echo "Testing option ID: $testing_option_id"
echo "FIELD_ID=$field_id" >> $GITHUB_ENV
echo "TESTING_OPTION_ID=$testing_option_id" >> $GITHUB_ENV
fi
- name: Set status to Testing
env:
GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_PAT }}
PROJECT_ITEM_ID: ${{ env.PROJECT_ITEM_ID }}
FIELD_ID: ${{ env.FIELD_ID }}
TESTING_OPTION_ID: ${{ env.TESTING_OPTION_ID }}
run: |
echo "Setting status for Project Item ID: ${PROJECT_ITEM_ID}"
result=$(gh api graphql -f query='
mutation($project:ID!, $item:ID!, $fieldId:ID!, $value:String!) {
updateProjectV2ItemFieldValue(input: {
projectId: $project
itemId: $item
fieldId: $fieldId
value: {
singleSelectOptionId: $value
}
}) {
projectV2Item {
id
}
}
}' -f project="PVT_kwDOCjbMFM4AjuUh" -f item="${PROJECT_ITEM_ID}" -f fieldId="${FIELD_ID}" -f value="${TESTING_OPTION_ID}")
echo "Set status result: $result"

114
.github/workflows/new-branch-created.yml vendored Normal file
View File

@@ -0,0 +1,114 @@
name: Update Issue Status to In Development
on:
create:
branches:
- '*-*'
jobs:
update-status:
runs-on: ubuntu-latest
steps:
- name: Extract Issue Number from Branch Name
id: extract-issue-number
run: |
ISSUE_NUMBER=$(echo $GITHUB_REF_NAME | cut -d'-' -f1)
echo "Issue Number extracted: $ISSUE_NUMBER"
echo "ISSUE_NUMBER=$ISSUE_NUMBER" >> $GITHUB_ENV
- name: Get project item ID
id: get-project-item-id
env:
GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_PAT }}
PROJECT_ID: "PVT_kwDOCjbMFM4AjuUh"
run: |
echo "Fetching project item ID for issue number: $ISSUE_NUMBER"
QUERY='
query fetchProjectItem($project: ID!) {
node(id: $project) {
... on ProjectV2 {
items(first: 100) {
nodes {
id
content {
... on Issue {
number
}
}
}
}
}
}
}'
item_id=$(gh api graphql -f query="$QUERY" -f project=$PROJECT_ID --jq '.data.node.items.nodes[] | select(.content.number == '"$ISSUE_NUMBER"') | .id')
if [ -z "$item_id" ]; then
echo "Error: Project item ID not found for issue number $ISSUE_NUMBER"
exit 1
else
echo "Project item ID found: $item_id"
echo "PROJECT_ITEM_ID=$item_id" >> $GITHUB_ENV
fi
- name: Get single select field ID and options
id: get-field-options
env:
GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_PAT }}
PROJECT_ID: "PVT_kwDOCjbMFM4AjuUh"
run: |
echo "Fetching field ID and options for status"
QUERY='
query($project:ID!) {
node(id: $project) {
... on ProjectV2 {
fields(first: 100) {
nodes {
... on ProjectV2SingleSelectField {
id
name
options {
id
name
}
}
}
}
}
}
}'
field_data=$(gh api graphql -f query="$QUERY" -f project=$PROJECT_ID --jq '.data.node.fields.nodes[] | select(.name == "Status")')
field_id=$(echo $field_data | jq -r '.id')
in_development_option_id=$(echo $field_data | jq -r '.options[] | select(.name == "In Development") | .id')
if [ -z "$field_id" ] || [ -z "$in_development_option_id" ]; then
echo "Error: Field ID or In Development option ID not found"
exit 1
else
echo "Field ID: $field_id"
echo "In Development option ID: $in_development_option_id"
echo "FIELD_ID=$field_id" >> $GITHUB_ENV
echo "IN_DEVELOPMENT_OPTION_ID=$in_development_option_id" >> $GITHUB_ENV
fi
- name: Set status to In Development
env:
GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_PAT }}
PROJECT_ITEM_ID: ${{ env.PROJECT_ITEM_ID }}
FIELD_ID: ${{ env.FIELD_ID }}
IN_DEVELOPMENT_OPTION_ID: ${{ env.IN_DEVELOPMENT_OPTION_ID }}
run: |
echo "Setting status for Project Item ID: ${PROJECT_ITEM_ID}"
result=$(gh api graphql -f query='
mutation($project:ID!, $item:ID!, $fieldId:ID!, $value:String!) {
updateProjectV2ItemFieldValue(input: {
projectId: $project
itemId: $item
fieldId: $fieldId
value: {
singleSelectOptionId: $value
}
}) {
projectV2Item {
id
}
}
}' -f project="PVT_kwDOCjbMFM4AjuUh" -f item="${PROJECT_ITEM_ID}" -f fieldId="${FIELD_ID}" -f value="${IN_DEVELOPMENT_OPTION_ID}")
echo "Set status result: $result"

View File

@@ -1,6 +1,14 @@
# Profilarr
Profilarr is a Python-based tool designed to add import/export/sync functionality to the \*arr suite. It offers a user-friendly way to export existing custom formats / profiles, import new ones or sync a master instance of Radarr / Sonarr with extras.
Profilarr is a Python-based tool designed to add import/export/sync/delete functionality to the \*arr suite. It offers a user-friendly way to:
- Export existing custom formats / profiles
- Import new custom formats / profiles
- Sync a master instance of Radarr / Sonarr with other instances
- Delete existing custom formats / quality profiles
## Discord
Come join us at https://discord.gg/ZxywYBGRB9 if you need any help or want to talk!
## ⚠️ Before Continuing
@@ -14,25 +22,61 @@ Profilarr is a Python-based tool designed to add import/export/sync functionalit
- Python 3.x installed. You can download it from [python.org](https://www.python.org/downloads/).
- Radarr / Sonarr
### 📦 Dependencies
- run `pip install -r requirements.txt` to install dependencies.
### Initial Setup
1. Download the latest Profilarr package from the release section.
2. Extract its contents into a folder.
3. Run `python setup.py` in your command line interface to generate a config file.
- This will create a `config.yml` file in the same directory as `setup.py`.
4. Open the `config.yml` file in a text editor.
- Add the URL and API key to the master instances of Radarr / Sonarr.
- If syncing, add the URL, API key and a name to each extra instance of Radarr / Sonarr.
- If exporting, adjust the `export_path` to your desired export location.
- If importing non Dictionarry files, adjust the `import_path` to your desired import location.
5. Save the changes.
#### Step 1: Download Profilarr
1. **Download Profilarr:**
- Go to the Profilarr GitHub page and find the "Releases" [section](https://github.com/santiagosayshey/Profilarr/releases).
- Download the latest release package.
2. **Extract Files:**
- Once downloaded, extract the zip file to a folder of your choice.
#### Step 2: Install Profilarr
1. **Open Your Terminal:**
- **Windows:** Search for `Command Prompt` or `PowerShell` in your start menu.
- **MacOS:** Search for `Terminal`.
- **Linux:** Use your desktop environment's application launcher to find `Terminal`, or press `Ctrl+Alt+T` if that's a shortcut in your Linux distro.
2. **Navigate to Profilarr Folder:**
- Type `cd path/to/your/folder` and press Enter. Replace `path/to/your/folder` with the actual path to where you extracted Profilarr. This command works the same on Windows, MacOS, and Linux.
3. **Install Dependencies:**
- Type `pip install -r requirements.txt` and press Enter. This command tells Python to install the necessary software components Profilarr needs to run. The command is the same across all platforms.
4. **Setup Configuration:**
- Type `python setup.py` and press Enter. This will run a setup script that prepares Profilarr for use by generating a `config.yml` file, essentially Profilarr's settings book.
#### Step 3: Configure Profilarr
1. **Edit `config.yml`:**
- Open the `config.yml` file in a text editor. Windows users might use Notepad, MacOS users might use TextEdit, and Linux users can use any text editor like Gedit, Nano, or Vim.
- This file contains different settings that you can adjust to tell Profilarr how to operate.
2. **Add Master Instance Details:**
- Look for the section related to Radarr/Sonarr.
- Here, enter the URL and API key for your Radarr/Sonarr instances to link Profilarr with your movie/TV series managers.
3. **Configure Syncing or Exporting (if needed):**
- **Syncing:** For syncing additional Radarr/Sonarr instances, add their URL, API key, and a name for each.
- **Exporting:** To set where Profilarr saves files it creates, adjust the `export_path`.
- **Importing:** If you have settings or lists from other sources, set `import_path` to their location.
4. **Configure ANSI Color Support (Optional):**
- Profilarr can show colorful text in the terminal. If it's not displaying correctly (like showing `←[94m` instead of colors), you can fix this:
- In the `settings` section, find `ansi_colors: true`.
- Change it to `ansi_colors: false`. This disables colorful output for better compatibility with your terminal's capabilities.
5. **Save Your Changes:**
- After adjusting these settings, save and close the `config.yml` file.
#### You're All Set!
## 🚀 Usage
- If using Windows, use `python script.py` or `py script.py`. If on Linux, use `python3 script.py`.
- If using Windows, use `python <script>` or `py <script>`. If on Linux, use `python3 <script>`.
### Importing
@@ -277,3 +321,5 @@ PS Z:\Profilarr>
Some custom formats found here have been interated on from the trash guides. Credit for these goes entirely to trash, and can be found on their site here. It is not my intention to steal their work, but rather to build on it and make it more accessible to the average user through my quality profiles. Please check out their site for more information on their work.
https://trash-guides.info/
test

View File

@@ -3,6 +3,7 @@ import json
import requests
from requests.exceptions import ConnectionError, Timeout, TooManyRedirects
import json
import sys
class Colors:
GREEN = '\033[92m'
@@ -20,24 +21,41 @@ class Apps:
}
def print_message(message, message_type='', newline=True):
color = Colors.ENDC # default color
message_type = message_type.lower()
config = load_config()
ansi_colors = config['settings']['ansi_colors']
if ansi_colors:
# Initialize color as default.
color = Colors.ENDC
message_type = message_type.lower()
if message_type == 'green':
color = Colors.GREEN
elif message_type == 'red':
color = Colors.RED
elif message_type == 'yellow':
color = Colors.YELLOW
elif message_type == 'blue':
color = Colors.BLUE
elif message_type == 'purple':
color = Colors.PURPLE
# Assign color based on message type.
if message_type == 'green':
color = Colors.GREEN
elif message_type == 'red':
color = Colors.RED
elif message_type == 'yellow':
color = Colors.YELLOW
elif message_type == 'blue':
color = Colors.BLUE
elif message_type == 'purple':
color = Colors.PURPLE
# Prepare the end color reset code.
end_color = Colors.ENDC
if newline:
print(color + message + Colors.ENDC)
# Print the colored message.
if newline:
print(color + message + end_color)
else:
print(color + message + end_color, end='')
else:
print(color + message + Colors.ENDC, end='')
# Print the message without color if ANSI colors are disabled.
if newline:
print(message)
else:
print(message, end='')
def load_config():
@@ -119,6 +137,7 @@ def make_request(request_type, url, api_key, resource_type, json_payload=None):
return None
elif response.status_code == 401:
print_message("Unauthorized. Check your API key.", "red")
sys.exit()
elif response.status_code == 409:
print_message("Conflict detected. The requested action could not be completed.", "red")
else:
@@ -126,6 +145,7 @@ def make_request(request_type, url, api_key, resource_type, json_payload=None):
except (ConnectionError, Timeout, TooManyRedirects) as e:
# Update the message here to suggest checking the application's accessibility
print_message("Network error. Make sure the application is running and accessible.", "red")
sys.exit()
return None

View File

@@ -17,6 +17,7 @@ instances:
settings:
export_path: "./exports"
import_path: "./imports"
ansi_colors: true
"""