Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Habitica: adding a todo with python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import requests, json, os
json_payload = {
"text": "Test Task",
"type": "todo",
"alias": "hab-api-tasks",
"notes": "This is a test task that was set with the python requests module.",
"priority": 2,
}
headers = {
"Content-Type":"application/json",
"x-api-user":os.environ["HABITICA_API_USER"],
"x-api-key":os.environ["HABITICA_API_KEY"],
"x-client":os.environ["HABITICA_API_CLIENT"],
}
response = requests.post("https://habitica.com/api/v3/tasks/user", json=json_payload, headers=headers)
print(response)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment