[![codecov](https://codecov.io/gh/rkhwaja/rtmilk/branch/master/graph/badge.svg?token=RaMYgorajr)](https://codecov.io/gh/rkhwaja/rtmilk) [![PyPI version](https://badge.fury.io/py/rtmilk.svg)](https://badge.fury.io/py/rtmilk)
Python wrapper for "Remember the Milk" [API](https://www.rememberthemilk.com/services/api/)
- Asynchronous and synchronous APIs
- Subscription support
# Usage of client
```python
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
```python
from rtmilk.api_sync import API
from rtmmilk.models import RTMError
api = API(API_KEY, SHARED_SECRET, TOKEN)
timeline = api.TimelinesCreate().timeline
try:
api.TasksAdd(timeline, 'task name')
except RTMError as e:
print(e)
```
```python
from rtmilk.api_async import APIAsync
from rtmmilk.models import RTMError
apiAsync = APIAsync(API_KEY, SHARED_SECRET, TOKEN)
timeline = await apiAsync.TimelinesCreate().timeline
try:
await apiAsync.TasksAdd(timeline, 'task name')
except RTMError as e:
print(e)
```
# Authorization
```python
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}')
```
Raw data
{
"_id": null,
"home_page": "https://github.com/rkhwaja/rtmilk",
"name": "rtmilk",
"maintainer": null,
"docs_url": null,
"requires_python": "<4,>=3.9",
"maintainer_email": null,
"keywords": "RememberTheMilk",
"author": "Rehan Khwaja",
"author_email": "rehan@khwaja.name",
"download_url": "https://files.pythonhosted.org/packages/c2/45/300a9faf95f0c8e8b8e078113223ccddbbb2896cff4b7d09081135b623b3/rtmilk-1.0.4.tar.gz",
"platform": null,
"description": "[![codecov](https://codecov.io/gh/rkhwaja/rtmilk/branch/master/graph/badge.svg?token=RaMYgorajr)](https://codecov.io/gh/rkhwaja/rtmilk) [![PyPI version](https://badge.fury.io/py/rtmilk.svg)](https://badge.fury.io/py/rtmilk)\n\nPython wrapper for \"Remember the Milk\" [API](https://www.rememberthemilk.com/services/api/)\n- Asynchronous and synchronous APIs\n- Subscription support\n\n# Usage of client\n```python\nfrom rtmilk.client import Client\nfrom rtmmilk.models import RTMError\n\n# These are the equivalent objects, created differently\nclient = Client.Create(API_KEY, SHARED_SECRET, TOKEN)\nclient2 = await Client.CreateAsync(API_KEY, SHARED_SECRET, TOKEN)\n\ntry:\n task = client.Add(name='name 1')\n assert task.complete.value is False\n task.tags.Set({'tag1', 'tag2'})\n assert task.tags.value == {'tag1', 'tag2'}\n task = await client.AddAsync(name='name 2')\n await task.tags.SetAsync({'tag1', 'tag2'})\n tasks = client2.Get('name:\"name 1\"')\n assert tasks[0].tags.value == {'tag1', 'tag2'}\nexcept RTMError as e:\n print(e)\n```\n\n# Usage of API functions directly\n```python\nfrom rtmilk.api_sync import API\nfrom rtmmilk.models import RTMError\n\napi = API(API_KEY, SHARED_SECRET, TOKEN)\n\ntimeline = api.TimelinesCreate().timeline\ntry:\n api.TasksAdd(timeline, 'task name')\nexcept RTMError as e:\n print(e)\n```\n\n```python\nfrom rtmilk.api_async import APIAsync\nfrom rtmmilk.models import RTMError\n\napiAsync = APIAsync(API_KEY, SHARED_SECRET, TOKEN)\n\ntimeline = await apiAsync.TimelinesCreate().timeline\ntry:\n await apiAsync.TasksAdd(timeline, 'task name')\nexcept RTMError as e:\n print(e)\n```\n\n# Authorization\n```python\nfrom rtmilk.authorization import AuthorizationSession\n\nauthenticationSession = AuthorizationSession(API_KEY, SHARED_SECRET, 'delete')\ninput(f'Go to {authenticationSession.url} and authorize. Then Press ENTER')\ntoken = authenticationSession.Done()\nprint(f'Authorization token is {token}')\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "RTM API wrapper",
"version": "1.0.4",
"project_urls": {
"Homepage": "https://github.com/rkhwaja/rtmilk"
},
"split_keywords": [
"rememberthemilk"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c5bbb90377d64d2a7f109478e28f4de41b6fb1dad02c2cf5d8835d5be489a408",
"md5": "974a6dfd5fc2188ef40cf36365a76658",
"sha256": "e573b0fc3cdddb3aa2b135af57da4c7b20c831ba2f6bea366ccb0ff05dbeeada"
},
"downloads": -1,
"filename": "rtmilk-1.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "974a6dfd5fc2188ef40cf36365a76658",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4,>=3.9",
"size": 18718,
"upload_time": "2024-04-23T04:58:52",
"upload_time_iso_8601": "2024-04-23T04:58:52.935224Z",
"url": "https://files.pythonhosted.org/packages/c5/bb/b90377d64d2a7f109478e28f4de41b6fb1dad02c2cf5d8835d5be489a408/rtmilk-1.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c245300a9faf95f0c8e8b8e078113223ccddbbb2896cff4b7d09081135b623b3",
"md5": "79b152cf8685d41740499a33a48cb72f",
"sha256": "5880b565882c06701501c6776d64e52eebe4fedc2f222f3189311d99098fd11a"
},
"downloads": -1,
"filename": "rtmilk-1.0.4.tar.gz",
"has_sig": false,
"md5_digest": "79b152cf8685d41740499a33a48cb72f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4,>=3.9",
"size": 14701,
"upload_time": "2024-04-23T04:58:54",
"upload_time_iso_8601": "2024-04-23T04:58:54.723928Z",
"url": "https://files.pythonhosted.org/packages/c2/45/300a9faf95f0c8e8b8e078113223ccddbbb2896cff4b7d09081135b623b3/rtmilk-1.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-23 04:58:54",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "rkhwaja",
"github_project": "rtmilk",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "rtmilk"
}