import urllib.request, urllib.error, urllib.parse
try:
    r = urllib.request.urlopen('https://push.geckoboard.com/v1/send/' + widget_key,
        json.dumps(nested_dict))
except IOError as e:
    if hasattr(e, 'reason'):
        pass
How to output JSON in python so it can be used for Geckoboard's Highcharts plugin