Beispiel #1
0
def create_menu(menu):
    logger.info(json.dumps(menu))
    rsp = HTTP.post(WX_URL_CREATE_MENU,
                    json.dumps(menu, ensure_ascii=False),
                    access_token=get_access_token())

    return json.loads(rsp)
Beispiel #2
0
def get_unlimit_qrcode_ticket(arg):
    args = {
        'action_name': 'QR_LIMIT_SCENE',
        'action_info': {
            'scene': {
                'scene_id': arg
            }
        }
    }
    rsp = HTTP.post(WX_URL_CREATE_QRCODE,
                    json.dumps(args),
                    access_token=get_access_token())
    logger.info('get a unlimit qrcode, arg: %s, ret: %s', arg, rsp)
    rsp = json.loads(rsp)
    return rsp['ticket']
Beispiel #3
0
def url_to_short(url):
    data = dict(action='long2short', long_url=url)
    rsp = HTTP.post(WX_URL_SHORTURL,
                    json.dumps(data),
                    access_token=get_access_token())
    return json.loads(rsp)
Beispiel #4
0
def make_order(order):
    result = HTTP.post(WX_URL_MAKE_ORDER, order.xml())
    return Message(result)