def post(url, params, jsonfmt=True):
    """
    @brief      http post request
    @param      url      String
    @param      params   Dict, post params
    @param      jsonfmt  Bool, whether is json format
    @return     http response
    """
    Log.debug('POST -> '+url)
    Log.debug(params)
    if jsonfmt:
        request = urllib2.Request(url=url, data=json.dumps(params, ensure_ascii=False).encode('utf8'))
        request.add_header(*Constant.HTTP_HEADER_CONTENTTYPE)
    else:
        request = urllib2.Request(url=url, data=urllib.urlencode(params))

    while True:
        try:
            response = urllib2.urlopen(request, timeout=30)
            data = response.read()
            response.close()

            if jsonfmt:
                Log.debug(data)
                return json.loads(data, object_hook=_decode_data)
            return data
        except (KeyboardInterrupt, SystemExit):
            raise
        except:
            Log.error(traceback.format_exc())

        time.sleep(1)

    @brief      http post request
    @param      url      String
    @param      params   Dict, post params
    @param      jsonfmt  Bool, whether is json format
    @return     http response
    
wxbot_project_py2.7/wechat/utils.py