RTM API wrapper
Project description
Python wrapper for "Remember the Milk" API
- Asynchronous and synchronous APIs
- Subscription support
Usage of client
from rtmilk.client import Client
from rtmmilk.models import RTMError
# These are the equivalent objects, created differently
client = Client.Create(API_KEY, SHARED_SECRET, TOKEN)
client2 = await Client.CreateAsync(API_KEY, SHARED_SECRET, TOKEN)
try:
task = client.Add(name='name 1')
assert task.complete.value is False
task.tags.Set({'tag1', 'tag2'})
assert task.tags.value == {'tag1', 'tag2'}
task = await client.AddAsync(name='name 2')
await task.tags.SetAsync({'tag1', 'tag2'})
tasks = client2.Get('name:"name 1"')
assert tasks[0].tags.value == {'tag1', 'tag2'}
except RTMError as e:
print(e)
Usage of API functions directly
from rtmilk.api_sync import API
from rtmmilk.models import FailStat
api = API(API_KEY, SHARED_SECRET, TOKEN)
timeline = api.TimelinesCreate().timeline
result = api.TasksAdd(timeline, 'task name')
if isinstance(result, FailStat):
print(f'Error: {result}')
from rtmilk.api_async import APIAsync
from rtmmilk.models import FailStat
apiAsync = APIAsync(API_KEY, SHARED_SECRET, TOKEN)
timeline = await apiAsync.TimelinesCreate().timeline
result = await apiAsync.TasksAdd(timeline, 'task name')
if isinstance(result, FailStat):
print(f'Error: {result}')
Authorization
from rtmilk.authorization import AuthorizationSession
authenticationSession = AuthorizationSession(API_KEY, SHARED_SECRET, 'delete')
input(f'Go to {authenticationSession.url} and authorize. Then Press ENTER')
token = authenticationSession.Done()
print(f'Authorization token is {token}')
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
rtmilk-2.1.0.tar.gz
(14.8 kB
view details)
Built Distribution
rtmilk-2.1.0-py3-none-any.whl
(18.8 kB
view details)
File details
Details for the file rtmilk-2.1.0.tar.gz
.
File metadata
- Download URL: rtmilk-2.1.0.tar.gz
- Upload date:
- Size: 14.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.1 Darwin/23.4.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37cc98b73c2af63531359c4a86ff1bd20b825d3c755cec73eff727ba530eb355 |
|
MD5 | 2dd177c3a863430e8d3039b815726c1c |
|
BLAKE2b-256 | 38901899b4a32e11bd77589066a4a233b676863936ce1230786c70992e6f0c77 |
File details
Details for the file rtmilk-2.1.0-py3-none-any.whl
.
File metadata
- Download URL: rtmilk-2.1.0-py3-none-any.whl
- Upload date:
- Size: 18.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.12.1 Darwin/23.4.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a2327c57749b31c88f34e9547dcd87f4796812f0756e70a21ca397daa6b0162 |
|
MD5 | 14cf917d309df236a1193bb05bf941a6 |
|
BLAKE2b-256 | 240ec04b1ec264a2e380ed3e244575923d15de7e7b3c1d7e22ab03b432112886 |