WeChat enterprise

微信企业号

  1. 通过API获取access_token
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    [root@wechat]# cat access_token.ops.py
    #!/usr/bin/env python
    #-*-coding:utf-8-*-
    import urllib
    import urllib2
    import json
    import os
    url = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid={微信ID号,唯一}&corpsecret={应用秘钥}"
    req = urllib2.Request(url)
    res_data = urllib2.urlopen(req)
    res = res_data.read()
    print(json.dumps(json.loads(res),indent=2,sort_keys=False,ensure_ascii=False))

    [root@cmdb wechat]# python access_token.ops.py
    {
    "access_token": "ZAyxiNS0-PIWLkDEqLFx1_-wXxJXJQYzjYt3fl8XxwEMGiQVixEsn2xKVc9ZLiJ_u6K6iN2IxFbxiV4jJi_nxyhS2l6a8TfvS7lMGvFBcwA_m4wlAQs0URSwaisGGEmlpRumUtQ-8LN8wKo9NTvpLv-o3kbteVdOadsfadfadsfafdadfasdfadf",
    "expires_in": 7200,
    "errcode": 0,
    "errmsg": "ok"
    }