From 19f596bffc4bb3018d4ccf0047ea00e550687842 Mon Sep 17 00:00:00 2001 From: abelzhu Date: Thu, 14 Jun 2018 12:33:20 +0800 Subject: [PATCH] Add files via upload --- api/examples/MiniprogramTest.py | 37 +++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 api/examples/MiniprogramTest.py diff --git a/api/examples/MiniprogramTest.py b/api/examples/MiniprogramTest.py new file mode 100644 index 0000000..1ec96c8 --- /dev/null +++ b/api/examples/MiniprogramTest.py @@ -0,0 +1,37 @@ +#!/usr/bin/env python +# -*- coding:utf-8 -*- +## + # Copyright (C) 2018 All rights reserved. + # + # @File UserTest.py + # @Brief + # @Author abelzhu, abelzhu@tencent.com + # @Version 1.0 + # @Date 2018-02-24 + # + # + +import sys +sys.path.append("../src/") + +import random + +from CorpApi import * +from TestConf import * + +## test +api = CorpApi(TestConf['CORP_ID'], TestConf['APP_SECRET']) + +try : +## + response = api.httpCall( + CORP_API_TYPE['MINIPROGRAM_CODE_TO_SESSION_KEY'], + { + "js_code" : "sVqtL3itg0L30LTGJtZ_isKC0efG5FqGw470fVp8Dpw", + "grant_type" : "authorization_code" + }) + print response + +except ApiException as e : + print e.errCode, e.errMsg +