import json
import urllib2
APPID = 测试号信息 appID
APPSECRET = 测试号信息 appsecret
url = 'https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET'
//获取 token
page = urllib2.urlopen(url).read()
jsonVal = json.loads(page)
print jsonVal
-
{ "access_token": "WfDfJhSsD0Bif8aa4myCqI-FD_ZIpATxW1MAHF87hXe0gpOYh4NVpNWDFKl2zR8hsq9Mr0bbJ0lBVWw347L01bj-daht3yzD2Tsc-sc1YSvWoG5A5TyC7Kg6nW_4ycsHMMnxiPBRHK21eJUVCYS_0A", "expires_in": 7200 }
"access_token": "WfDfJhSsD0Bif8aa4myCqI-FD_ZIpATxW1MAHF87hXe0gpOYh4NVpNWDFKl2zR8hsq9Mr0bbJ0lBVWw347L01bj-daht3yzD2Tsc-sc1YSvWoG5A5TyC7Kg6nW_4ycsHMMnxiPBRHK21eJUVCYS_0A", "expires_in": 7200 }
原文链接:http://my.oschina.net/u/1272391/blog/214143