Skip to main content
2 of 4
added 89 characters in body
Brock Adams
  • 13k
  • 5
  • 39
  • 64

Since I was retagging questions (didn't really need to change the body, just resend it), 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
            }
        )
Tim
  • 581
  • 2
  • 11