Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
This Python script automates the import of tasks (work packages) into a self-hosted OpenProject instance using the OpenProject REST API (v3). It reads a CSV file containing task details and posts them into the specified OpenProject project.

Key features:
- Reads any user-provided CSV file containing `Subject`, `Description`, `Status`, and `Priority` columns.
- Reads any user-provided CSV file containing `Subject`, `Description`, `Status`, and `Priority` columns, as well as any custom columns specified in the first row of the CSV.
- Authenticates using OpenProject API tokens (passed as Basic Auth with username `apikey`).
- Loops through all CSV rows and creates work packages (usually of type `Task`).
- Loops through all CSV rows and creates work packages (usually of type `Task`, although this can be customized using the Type column).
- Provides basic error checking and API connectivity validation.

## Requirements
Expand All @@ -21,11 +21,12 @@ pip install requests pandas
```

## Script Functionality
- Prompts the user for:
- If a config is not specified, the script prompts the user for:
- OpenProject URL (e.g., http://openproject.local)
- OpenProject API token (generated from your user account page)
- Numeric Project ID (e.g., 3)
- Full path to the CSV file (e.g., D:/path/to/progress_import_ready.csv)
- if a config is provided as the first parameter, it should include the above mentioned params, look at the sample config provided.
- Checks if the CSV file exists and loads it.
- Validates the API token by making a test GET request.
- Iterates over each row and posts a new work package via the API.
Expand All @@ -38,6 +39,12 @@ Your CSV should include at least the following columns:
- `Status` (e.g., "New", "In Progress", "Closed")
- `Priority` (e.g., "Normal", "High", "Low")

## How to run the script
To run the script with a config file, make sure the config has the right values in it and type this into your terminal:
```bash
python import_requests_basicauth.py config.json
```

## How to Build an Executable
To run this in an air-gapped environment as a standalone executable:

Expand All @@ -63,7 +70,7 @@ dist/openproject_importer.exe
openproject_importer.exe
```

6️ Follow the prompts to enter your OpenProject connection details and import tasks.
6️ If you didn't use a config file, follow the prompts to enter your OpenProject connection details and import tasks.

## Notes
- The script relies on the OpenProject REST API v3.
Expand Down
32 changes: 32 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"openproject_url": "OPEN_PROJECT_URL",
"api_token": "YOUR_PROJECT_API_TOKEN",
"project_id": PROJECT_ID,
"csv_file": "SAMPLE.csv",
"user_map": {
"custom_user": 1,
"custom_user2": 2
},

"status_map": {
"New": 1,
"In Progress": 2,
"Closed": 3
},

"priority_map": {
"Low": 7,
"Normal": 8,
"immediate": 10,
"High": 9
},

"type_map": {
"Task": 1,
"Milestone":2,
"Summary task": 3
}

// add custom maps in here following the same format, make sure to use the correct name/numbers in your project
// remove this comment when executing script
}
75 changes: 0 additions & 75 deletions import requests_basicauth.py

This file was deleted.

Loading