Python http.client json request and response. How?

Viewed 91829

I have the following code that I'd like to update to Python 3.x The required libraries would change to http.client and json.

I can't seem to understand how to do it. Can you please help?

import urllib2
import json


data = {"text": "Hello world github/linguist#1 **cool**, and #1!"}
json_data = json.dumps(data)

req = urllib2.Request("https://api.github.com/markdown")
result = urllib2.urlopen(req, json_data)

print '\n'.join(result.readlines())
3 Answers
Related