Skip to content

Instantly share code, notes, and snippets.

@SunSparc
Created August 6, 2019 18:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SunSparc/cf625528651cc5ade11b73853d49674e to your computer and use it in GitHub Desktop.
Save SunSparc/cf625528651cc5ade11b73853d49674e to your computer and use it in GitHub Desktop.
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