Skip to content

Instantly share code, notes, and snippets.

Created August 14, 2019 12:20
What would you like to do?
Making requests to tiddlywiki
"""Code showing how to create a tiddler in tiddly wiki using python. I was not able to get this working without the "X-Requested-With" header."""
import requests
TIDDLY_WIKI_URL = 'https://localhost:8080'
# this "X-Requested-With" header is the key to making these requests work
'X-Requested-With': 'TiddlyWiki',
'Content-Type': 'application/json'
tiddler_data = {
'title': 'foo',
'text': 'bar'
url_path = f'{TIDDLY_WIKI_URL}/recipes/default/tiddlers/{tiddler_title}'
response = requests.put(url, data=tiddler_data, headers=TIDDLY_WIKI_REQUEST_HEADERS)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment