I ended up using the body_markdown
, encoded with HTMLParser.HTMLParser().unescape()
body_markdown = str(HTMLParser.HTMLParser().unescape(question_data['items'][0]['body_markdown']))
<%%>
And then sending it with:
response = requests.post('https://api.stackexchange.com/2.2/questions/'+str(q_id)+'/edit',
data={'body': body_markdown,
'comment': 'removed '+tag+' tag',
'tags': ' '.join(tags),
'title': title,
'access_token': token,
'site': site,
'key': key
}
)