Unofficial Reclaim.ai Python API
Project description
reclaim-sdk - Unofficial Reclaim.ai Python SDK
This is an unofficial Python SDK for the Reclaim.ai API. It is not affiliated with Reclaim.ai in any way and was reverse engineered from the Reclaim.ai web app. That means there can be bugs and the API may change at any time, a versioning is not possible.
Features
Currently only task management is supported. As there might be an official SDK in the future, this SDK won't implement all features of the web app.
Installation
pip install reclaim-sdk
Configuration
The only configuration needed is the token. You can get it from the Reclaim.ai web app, by copying it from the browser's developer tools. It's stored in the cookie named RECLAIM
.
There are 3 ways to configure the token:
- You can initiate the
ReclaimClient
class with the token as thetoken
argument. AsReclaimClient
is a singleton, you should initiate this class at the beginning of your script / program. It will be used for all subsequent calls. - You can set the environment variable
RECLAIM_TOKEN
to the token. - You can store the token in a toml file named
.reclaim.toml
in your home directory. It should look like this:
[reclaim_ai]
token = <YOUR_TOKEN>
Usage
All CRUD operations are supported, but for now only tasks are implemented. Nevertheless the API is designed to be easily extendable, by adding new classes for other resources. All "heavy lifting" is done in the ReclaimModel
class, which is the base class for all other models.
Creating a task
from reclaim_sdk.models.task import ReclaimTask
from datetime import datetime, timedelta
# The objects can be used as context managers, so they will automatically
# be saved to the API when exiting the context.
with ReclaimTask() as task:
task.name = "test_task_12345"
# All durations are set in hours
task.duration = 5
task.min_work_duration = 0.75
task.max_work_duration = 2
# The start date is set to 3 days in the future
task.start_date = datetime.now() + timedelta(days=3)
# The due date is set to 5 days in the future
task.due_date = datetime.now() + timedelta(days=5)
# It is also possible to create an object without using a context manager.
task = ReclaimTask()
task.name = "test_task_12345"
task.duration = 5
task.min_work_duration = 0.75
task.max_work_duration = 2
task.start_date = datetime.now() + timedelta(days=3)
task.due_date = datetime.now() + timedelta(days=5)
# Then the object needs to be saved manually to the API.
task.save()
# If you want to let Reclaim.ai the priorities according to the due date, you can do so by triggering the auto prioritize method.
ReclaimTask.prioritize_by_due()
Updating and searching tasks
from reclaim_sdk.models.task import ReclaimTask
# By default the search method returns all tasks except archived ones
# (marked as completed)
tasks = ReclaimTask.search()
# Setting all tasks to work tasks
for task in tasks:
with task:
task.is_work_task = True
# We can also search for tasks by name or other fields
# (but they have to be exact matches)
tasks = ReclaimTask.search(title="My task")
# If we have the task ID we can get the task directly
task = ReclaimTask.get(12345)
Deleting tasks
from reclaim_sdk.models.task import ReclaimTask
# Get the desired task
task = ReclaimTask.get(12345)
# Delete the task
task.delete()
Contributing
Contributions are welcome. Please open an issue or a pull request. If you want to add a new resource, please have a look at the ReclaimModel
class and the ReclaimTask
class. The ReclaimTask
class is a good example of how to implement a new resource.
License
Copyright (c) 2022 Laurence Labusch
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Project details
Release history Release notifications | RSS feed
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 reclaim_sdk-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bf7acf9a5f44bd377179f1289204b698f2a96be8b3dbb00fc567cdc2e09f132d |
|
MD5 | 8ecd054bd4db86dca09e706413b4ad42 |
|
BLAKE2b-256 | 8aebc6b4ebb673c32a02ce53d153ff4464080bd43ebca3e27a72a9df5f52d4fe |