partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | WeChatMessage.send_template | 发送模板消息
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1445241432&lang=zh_CN
:param user_id: 用户 ID 。 就是你收到的 `Message` 的 source
:param template_id: 模板 ID。在公众平台线上模板库中选用模板获得
:param url: 链接地址
:param data: 模板消息数据
:param mini_program: 跳小程序所需数据, 如:`{'appid': 'appid', 'pagepat... | wechatpy/client/api/message.py | def send_template(self, user_id, template_id, data, url=None, mini_program=None):
"""
发送模板消息
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1445241432&lang=zh_CN
:param user_id: 用户 ID 。 就是你收到的 `Message` 的 source
:param template_id: 模板 ID。在公众平台线上模板库中选用模板获得
:param url: ... | def send_template(self, user_id, template_id, data, url=None, mini_program=None):
"""
发送模板消息
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1445241432&lang=zh_CN
:param user_id: 用户 ID 。 就是你收到的 `Message` 的 source
:param template_id: 模板 ID。在公众平台线上模板库中选用模板获得
:param url: ... | [
"发送模板消息"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/message.py#L564-L588 | [
"def",
"send_template",
"(",
"self",
",",
"user_id",
",",
"template_id",
",",
"data",
",",
"url",
"=",
"None",
",",
"mini_program",
"=",
"None",
")",
":",
"tpl_data",
"=",
"optionaldict",
"(",
"touser",
"=",
"user_id",
",",
"template_id",
"=",
"template_id... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatMessage.send_mass_card | 群发卡券消息
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1481187827_i0l21
:param group_or_users: 值为整型数字时为按分组群发,值为列表/元组时为按 OpenID 列表群发
当 is_to_all 为 True 时,传入 None 即对所有用户发送。
:param card_id: 卡券 ID
:param is_to_all: 用于设定是否向全部用户发送,值为true或false,选择true该消息群发给所有用户... | wechatpy/client/api/message.py | def send_mass_card(self, group_or_users, card_id,
is_to_all=False, preview=False,
send_ignore_reprint=0, client_msg_id=None):
"""
群发卡券消息
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1481187827_i0l21
:param group_or_users: 值为整型数字时为按分组群发,... | def send_mass_card(self, group_or_users, card_id,
is_to_all=False, preview=False,
send_ignore_reprint=0, client_msg_id=None):
"""
群发卡券消息
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1481187827_i0l21
:param group_or_users: 值为整型数字时为按分组群发,... | [
"群发卡券消息"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/message.py#L609-L648 | [
"def",
"send_mass_card",
"(",
"self",
",",
"group_or_users",
",",
"card_id",
",",
"is_to_all",
"=",
"False",
",",
"preview",
"=",
"False",
",",
"send_ignore_reprint",
"=",
"0",
",",
"client_msg_id",
"=",
"None",
")",
":",
"return",
"self",
".",
"_send_mass_m... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatMessage.get_subscribe_authorize_url | 构造请求用户授权的url
详情请参阅:
https://mp.weixin.qq.com/wiki?id=mp1500374289_66bvB
:param scene: 订阅场景值,开发者可以填0-10000的整形值,用来标识订阅场景值
:type scene: int
:param template_id: 订阅消息模板ID,登录公众平台后台,在接口权限列表处可查看订阅模板ID
:param redirect_url: 授权后重定向的回调地址
:param reserved: 用于保持请求和回调的状态,授权请后原样带... | wechatpy/client/api/message.py | def get_subscribe_authorize_url(self, scene, template_id, redirect_url, reserved=None):
"""
构造请求用户授权的url
详情请参阅:
https://mp.weixin.qq.com/wiki?id=mp1500374289_66bvB
:param scene: 订阅场景值,开发者可以填0-10000的整形值,用来标识订阅场景值
:type scene: int
:param template_id: 订阅消息模板ID,登录公众平... | def get_subscribe_authorize_url(self, scene, template_id, redirect_url, reserved=None):
"""
构造请求用户授权的url
详情请参阅:
https://mp.weixin.qq.com/wiki?id=mp1500374289_66bvB
:param scene: 订阅场景值,开发者可以填0-10000的整形值,用来标识订阅场景值
:type scene: int
:param template_id: 订阅消息模板ID,登录公众平... | [
"构造请求用户授权的url",
"详情请参阅:",
"https",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki?id",
"=",
"mp1500374289_66bvB"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/message.py#L650-L675 | [
"def",
"get_subscribe_authorize_url",
"(",
"self",
",",
"scene",
",",
"template_id",
",",
"redirect_url",
",",
"reserved",
"=",
"None",
")",
":",
"if",
"reserved",
"is",
"None",
":",
"reserved",
"=",
"random_string",
"(",
")",
"base_url",
"=",
"'https://mp.wei... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatMessage.send_subscribe_template | 一次性订阅消息,通过API推送订阅模板消息给到授权微信用户。
详情请参阅:
https://mp.weixin.qq.com/wiki?id=mp1500374289_66bvB
:param openid: 填接收消息的用户openid
:param template_id: 订阅消息模板ID
:param scene: 订阅场景值,开发者可以填0-10000的整形值,用来标识订阅场景值
:type scene: int
:param title: 消息标题,15字以内
:param data: 消息正... | wechatpy/client/api/message.py | def send_subscribe_template(self, openid, template_id, scene, title, data, url=None):
"""
一次性订阅消息,通过API推送订阅模板消息给到授权微信用户。
详情请参阅:
https://mp.weixin.qq.com/wiki?id=mp1500374289_66bvB
:param openid: 填接收消息的用户openid
:param template_id: 订阅消息模板ID
:param scene: 订阅场景值,开发者可... | def send_subscribe_template(self, openid, template_id, scene, title, data, url=None):
"""
一次性订阅消息,通过API推送订阅模板消息给到授权微信用户。
详情请参阅:
https://mp.weixin.qq.com/wiki?id=mp1500374289_66bvB
:param openid: 填接收消息的用户openid
:param template_id: 订阅消息模板ID
:param scene: 订阅场景值,开发者可... | [
"一次性订阅消息,通过API推送订阅模板消息给到授权微信用户。",
"详情请参阅:",
"https",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki?id",
"=",
"mp1500374289_66bvB"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/message.py#L677-L705 | [
"def",
"send_subscribe_template",
"(",
"self",
",",
"openid",
",",
"template_id",
",",
"scene",
",",
"title",
",",
"data",
",",
"url",
"=",
"None",
")",
":",
"post_data",
"=",
"{",
"'touser'",
":",
"openid",
",",
"'template_id'",
":",
"template_id",
",",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatCustomService.add_account | 添加客服账号
详情请参考
http://mp.weixin.qq.com/wiki/1/70a29afed17f56d537c833f89be979c9.html
:param account: 完整客服账号,格式为:账号前缀@公众号微信号
:param nickname: 客服昵称,最长6个汉字或12个英文字符
:param password: 客服账号登录密码
:return: 返回的 JSON 数据包 | wechatpy/client/api/customservice.py | def add_account(self, account, nickname, password):
"""
添加客服账号
详情请参考
http://mp.weixin.qq.com/wiki/1/70a29afed17f56d537c833f89be979c9.html
:param account: 完整客服账号,格式为:账号前缀@公众号微信号
:param nickname: 客服昵称,最长6个汉字或12个英文字符
:param password: 客服账号登录密码
:return: 返回的 JS... | def add_account(self, account, nickname, password):
"""
添加客服账号
详情请参考
http://mp.weixin.qq.com/wiki/1/70a29afed17f56d537c833f89be979c9.html
:param account: 完整客服账号,格式为:账号前缀@公众号微信号
:param nickname: 客服昵称,最长6个汉字或12个英文字符
:param password: 客服账号登录密码
:return: 返回的 JS... | [
"添加客服账号",
"详情请参考",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"1",
"/",
"70a29afed17f56d537c833f89be979c9",
".",
"html"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/customservice.py#L15-L35 | [
"def",
"add_account",
"(",
"self",
",",
"account",
",",
"nickname",
",",
"password",
")",
":",
"password",
"=",
"to_binary",
"(",
"password",
")",
"password",
"=",
"hashlib",
".",
"md5",
"(",
"password",
")",
".",
"hexdigest",
"(",
")",
"return",
"self",... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatCustomService.delete_account | 删除客服账号
详情请参考
http://mp.weixin.qq.com/wiki/1/70a29afed17f56d537c833f89be979c9.html
:param account: 完整客服账号,格式为:账号前缀@公众号微信号
:return: 返回的 JSON 数据包 | wechatpy/client/api/customservice.py | def delete_account(self, account):
"""
删除客服账号
详情请参考
http://mp.weixin.qq.com/wiki/1/70a29afed17f56d537c833f89be979c9.html
:param account: 完整客服账号,格式为:账号前缀@公众号微信号
:return: 返回的 JSON 数据包
"""
params_data = [
'access_token={0}'.format(quote(self.acce... | def delete_account(self, account):
"""
删除客服账号
详情请参考
http://mp.weixin.qq.com/wiki/1/70a29afed17f56d537c833f89be979c9.html
:param account: 完整客服账号,格式为:账号前缀@公众号微信号
:return: 返回的 JSON 数据包
"""
params_data = [
'access_token={0}'.format(quote(self.acce... | [
"删除客服账号",
"详情请参考",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"1",
"/",
"70a29afed17f56d537c833f89be979c9",
".",
"html"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/customservice.py#L59-L76 | [
"def",
"delete_account",
"(",
"self",
",",
"account",
")",
":",
"params_data",
"=",
"[",
"'access_token={0}'",
".",
"format",
"(",
"quote",
"(",
"self",
".",
"access_token",
")",
")",
",",
"'kf_account={0}'",
".",
"format",
"(",
"quote",
"(",
"to_binary",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatCustomService.upload_headimg | 上传客服账号头像
详情请参考
http://mp.weixin.qq.com/wiki/1/70a29afed17f56d537c833f89be979c9.html
:param account: 完整客服账号
:param media_file: 要上传的头像文件,一个 File-Object
:return: 返回的 JSON 数据包 | wechatpy/client/api/customservice.py | def upload_headimg(self, account, media_file):
"""
上传客服账号头像
详情请参考
http://mp.weixin.qq.com/wiki/1/70a29afed17f56d537c833f89be979c9.html
:param account: 完整客服账号
:param media_file: 要上传的头像文件,一个 File-Object
:return: 返回的 JSON 数据包
"""
return self._post(
... | def upload_headimg(self, account, media_file):
"""
上传客服账号头像
详情请参考
http://mp.weixin.qq.com/wiki/1/70a29afed17f56d537c833f89be979c9.html
:param account: 完整客服账号
:param media_file: 要上传的头像文件,一个 File-Object
:return: 返回的 JSON 数据包
"""
return self._post(
... | [
"上传客服账号头像",
"详情请参考",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"1",
"/",
"70a29afed17f56d537c833f89be979c9",
".",
"html"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/customservice.py#L92-L110 | [
"def",
"upload_headimg",
"(",
"self",
",",
"account",
",",
"media_file",
")",
":",
"return",
"self",
".",
"_post",
"(",
"'https://api.weixin.qq.com/customservice/kfaccount/uploadheadimg'",
",",
"params",
"=",
"{",
"'kf_account'",
":",
"account",
"}",
",",
"files",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatCustomService.create_session | 多客服创建会话
详情请参考
http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html
:param openid: 客户 openid
:param account: 完整客服账号
:param text: 附加信息,可选
:return: 返回的 JSON 数据包 | wechatpy/client/api/customservice.py | def create_session(self, openid, account, text=None):
"""
多客服创建会话
详情请参考
http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html
:param openid: 客户 openid
:param account: 完整客服账号
:param text: 附加信息,可选
:return: 返回的 JSON 数据包
"""
dat... | def create_session(self, openid, account, text=None):
"""
多客服创建会话
详情请参考
http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html
:param openid: 客户 openid
:param account: 完整客服账号
:param text: 附加信息,可选
:return: 返回的 JSON 数据包
"""
dat... | [
"多客服创建会话",
"详情请参考",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"2",
"/",
"6c20f3e323bdf5986cfcb33cbd3b829a",
".",
"html"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/customservice.py#L126-L145 | [
"def",
"create_session",
"(",
"self",
",",
"openid",
",",
"account",
",",
"text",
"=",
"None",
")",
":",
"data",
"=",
"optionaldict",
"(",
"openid",
"=",
"openid",
",",
"kf_account",
"=",
"account",
",",
"text",
"=",
"text",
")",
"return",
"self",
".",... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatCustomService.get_session_list | 获取客服的会话列表
详情请参考
http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html
:param account: 完整客服账号
:return: 客服的会话列表 | wechatpy/client/api/customservice.py | def get_session_list(self, account):
"""
获取客服的会话列表
详情请参考
http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html
:param account: 完整客服账号
:return: 客服的会话列表
"""
res = self._get(
'https://api.weixin.qq.com/customservice/kfsession/getse... | def get_session_list(self, account):
"""
获取客服的会话列表
详情请参考
http://mp.weixin.qq.com/wiki/2/6c20f3e323bdf5986cfcb33cbd3b829a.html
:param account: 完整客服账号
:return: 客服的会话列表
"""
res = self._get(
'https://api.weixin.qq.com/customservice/kfsession/getse... | [
"获取客服的会话列表",
"详情请参考",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"2",
"/",
"6c20f3e323bdf5986cfcb33cbd3b829a",
".",
"html"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/customservice.py#L182-L196 | [
"def",
"get_session_list",
"(",
"self",
",",
"account",
")",
":",
"res",
"=",
"self",
".",
"_get",
"(",
"'https://api.weixin.qq.com/customservice/kfsession/getsessionlist'",
",",
"params",
"=",
"{",
"'kf_account'",
":",
"account",
"}",
",",
"result_processor",
"=",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatCustomService.get_records | 获取客服聊天记录
:param start_time: 查询开始时间,UNIX 时间戳
:param end_time: 查询结束时间,UNIX 时间戳,每次查询不能跨日查询
:param msgid: 消息id顺序从小到大,从1开始
:param number: 每次获取条数,最多10000条
:return: 返回的 JSON 数据包 | wechatpy/client/api/customservice.py | def get_records(self, start_time, end_time, msgid=1,
number=10000):
"""
获取客服聊天记录
:param start_time: 查询开始时间,UNIX 时间戳
:param end_time: 查询结束时间,UNIX 时间戳,每次查询不能跨日查询
:param msgid: 消息id顺序从小到大,从1开始
:param number: 每次获取条数,最多10000条
:return: 返回的 JSON 数据包... | def get_records(self, start_time, end_time, msgid=1,
number=10000):
"""
获取客服聊天记录
:param start_time: 查询开始时间,UNIX 时间戳
:param end_time: 查询结束时间,UNIX 时间戳,每次查询不能跨日查询
:param msgid: 消息id顺序从小到大,从1开始
:param number: 每次获取条数,最多10000条
:return: 返回的 JSON 数据包... | [
"获取客服聊天记录"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/customservice.py#L210-L236 | [
"def",
"get_records",
"(",
"self",
",",
"start_time",
",",
"end_time",
",",
"msgid",
"=",
"1",
",",
"number",
"=",
"10000",
")",
":",
"if",
"isinstance",
"(",
"start_time",
",",
"datetime",
".",
"datetime",
")",
":",
"start_time",
"=",
"time",
".",
"mk... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | create_reply | Create a reply quickly | wechatpy/replies.py | def create_reply(reply, message=None, render=False):
"""
Create a reply quickly
"""
r = None
if not reply:
r = EmptyReply()
elif isinstance(reply, BaseReply):
r = reply
if message:
r.source = message.target
r.target = message.source
elif isinst... | def create_reply(reply, message=None, render=False):
"""
Create a reply quickly
"""
r = None
if not reply:
r = EmptyReply()
elif isinstance(reply, BaseReply):
r = reply
if message:
r.source = message.target
r.target = message.source
elif isinst... | [
"Create",
"a",
"reply",
"quickly"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/replies.py#L315-L342 | [
"def",
"create_reply",
"(",
"reply",
",",
"message",
"=",
"None",
",",
"render",
"=",
"False",
")",
":",
"r",
"=",
"None",
"if",
"not",
"reply",
":",
"r",
"=",
"EmptyReply",
"(",
")",
"elif",
"isinstance",
"(",
"reply",
",",
"BaseReply",
")",
":",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | deserialize_reply | 反序列化被动回复
:param xml: 待反序列化的xml
:param update_time: 是否用当前时间替换xml中的时间
:raises ValueError: 不能辨识的reply xml
:rtype: wechatpy.replies.BaseReply | wechatpy/replies.py | def deserialize_reply(xml, update_time=False):
"""
反序列化被动回复
:param xml: 待反序列化的xml
:param update_time: 是否用当前时间替换xml中的时间
:raises ValueError: 不能辨识的reply xml
:rtype: wechatpy.replies.BaseReply
"""
if not xml:
return EmptyReply()
try:
reply_dict = xmltodict.parse(xml)["xm... | def deserialize_reply(xml, update_time=False):
"""
反序列化被动回复
:param xml: 待反序列化的xml
:param update_time: 是否用当前时间替换xml中的时间
:raises ValueError: 不能辨识的reply xml
:rtype: wechatpy.replies.BaseReply
"""
if not xml:
return EmptyReply()
try:
reply_dict = xmltodict.parse(xml)["xm... | [
"反序列化被动回复",
":",
"param",
"xml",
":",
"待反序列化的xml",
":",
"param",
"update_time",
":",
"是否用当前时间替换xml中的时间",
":",
"raises",
"ValueError",
":",
"不能辨识的reply",
"xml",
":",
"rtype",
":",
"wechatpy",
".",
"replies",
".",
"BaseReply"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/replies.py#L345-L374 | [
"def",
"deserialize_reply",
"(",
"xml",
",",
"update_time",
"=",
"False",
")",
":",
"if",
"not",
"xml",
":",
"return",
"EmptyReply",
"(",
")",
"try",
":",
"reply_dict",
"=",
"xmltodict",
".",
"parse",
"(",
"xml",
")",
"[",
"\"xml\"",
"]",
"msg_type",
"... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | BaseReply.render | Render reply from Python object to XML string | wechatpy/replies.py | def render(self):
"""Render reply from Python object to XML string"""
tpl = '<xml>\n{data}\n</xml>'
nodes = []
msg_type = '<MsgType><![CDATA[{msg_type}]]></MsgType>'.format(
msg_type=self.type
)
nodes.append(msg_type)
for name, field in self._fields.it... | def render(self):
"""Render reply from Python object to XML string"""
tpl = '<xml>\n{data}\n</xml>'
nodes = []
msg_type = '<MsgType><![CDATA[{msg_type}]]></MsgType>'.format(
msg_type=self.type
)
nodes.append(msg_type)
for name, field in self._fields.it... | [
"Render",
"reply",
"from",
"Python",
"object",
"to",
"XML",
"string"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/replies.py#L66-L79 | [
"def",
"render",
"(",
"self",
")",
":",
"tpl",
"=",
"'<xml>\\n{data}\\n</xml>'",
"nodes",
"=",
"[",
"]",
"msg_type",
"=",
"'<MsgType><![CDATA[{msg_type}]]></MsgType>'",
".",
"format",
"(",
"msg_type",
"=",
"self",
".",
"type",
")",
"nodes",
".",
"append",
"(",... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | BaseWeChatComponent.fetch_access_token | 获取 component_access_token
详情请参考 https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list\
&t=resource/res_list&verify=1&id=open1419318587&token=&lang=zh_CN
:return: 返回的 JSON 数据包 | wechatpy/component.py | def fetch_access_token(self):
"""
获取 component_access_token
详情请参考 https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list\
&t=resource/res_list&verify=1&id=open1419318587&token=&lang=zh_CN
:return: 返回的 JSON 数据包
"""
url = '{0}{1}'.format(
self.... | def fetch_access_token(self):
"""
获取 component_access_token
详情请参考 https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list\
&t=resource/res_list&verify=1&id=open1419318587&token=&lang=zh_CN
:return: 返回的 JSON 数据包
"""
url = '{0}{1}'.format(
self.... | [
"获取",
"component_access_token",
"详情请参考",
"https",
":",
"//",
"open",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"cgi",
"-",
"bin",
"/",
"showdocument?action",
"=",
"dir_list",
"\\",
"&t",
"=",
"resource",
"/",
"res_list&verify",
"=",
"1&id",
"=",
"open1419... | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/component.py#L226-L245 | [
"def",
"fetch_access_token",
"(",
"self",
")",
":",
"url",
"=",
"'{0}{1}'",
".",
"format",
"(",
"self",
".",
"API_BASE_URL",
",",
"'/component/api_component_token'",
")",
"return",
"self",
".",
"_fetch_access_token",
"(",
"url",
"=",
"url",
",",
"data",
"=",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | BaseWeChatComponent._fetch_access_token | The real fetch access token | wechatpy/component.py | def _fetch_access_token(self, url, data):
""" The real fetch access token """
logger.info('Fetching component access token')
res = self._http.post(
url=url,
data=data
)
try:
res.raise_for_status()
except requests.RequestException as req... | def _fetch_access_token(self, url, data):
""" The real fetch access token """
logger.info('Fetching component access token')
res = self._http.post(
url=url,
data=data
)
try:
res.raise_for_status()
except requests.RequestException as req... | [
"The",
"real",
"fetch",
"access",
"token"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/component.py#L247-L283 | [
"def",
"_fetch_access_token",
"(",
"self",
",",
"url",
",",
"data",
")",
":",
"logger",
".",
"info",
"(",
"'Fetching component access token'",
")",
"res",
"=",
"self",
".",
"_http",
".",
"post",
"(",
"url",
"=",
"url",
",",
"data",
"=",
"data",
")",
"t... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatComponent.get_pre_auth_url_m | 快速获取pre auth url,可以直接微信中发送该链接,直接授权 | wechatpy/component.py | def get_pre_auth_url_m(self, redirect_uri):
"""
快速获取pre auth url,可以直接微信中发送该链接,直接授权
"""
url = "https://mp.weixin.qq.com/safe/bindcomponent?action=bindcomponent&auth_type=3&no_scan=1&"
redirect_uri = quote(redirect_uri, safe='')
return "{0}component_appid={1}&pre_auth_code=... | def get_pre_auth_url_m(self, redirect_uri):
"""
快速获取pre auth url,可以直接微信中发送该链接,直接授权
"""
url = "https://mp.weixin.qq.com/safe/bindcomponent?action=bindcomponent&auth_type=3&no_scan=1&"
redirect_uri = quote(redirect_uri, safe='')
return "{0}component_appid={1}&pre_auth_code=... | [
"快速获取pre",
"auth",
"url,可以直接微信中发送该链接,直接授权"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/component.py#L326-L334 | [
"def",
"get_pre_auth_url_m",
"(",
"self",
",",
"redirect_uri",
")",
":",
"url",
"=",
"\"https://mp.weixin.qq.com/safe/bindcomponent?action=bindcomponent&auth_type=3&no_scan=1&\"",
"redirect_uri",
"=",
"quote",
"(",
"redirect_uri",
",",
"safe",
"=",
"''",
")",
"return",
"\... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatComponent.query_auth | 使用授权码换取公众号的授权信息,同时储存token信息
:params authorization_code: 授权code,会在授权成功时返回给第三方平台,详见第三方平台授权流程说明 | wechatpy/component.py | def query_auth(self, authorization_code):
"""
使用授权码换取公众号的授权信息,同时储存token信息
:params authorization_code: 授权code,会在授权成功时返回给第三方平台,详见第三方平台授权流程说明
"""
result = self._query_auth(authorization_code)
assert result is not None \
and 'authorization_info' in result \
... | def query_auth(self, authorization_code):
"""
使用授权码换取公众号的授权信息,同时储存token信息
:params authorization_code: 授权code,会在授权成功时返回给第三方平台,详见第三方平台授权流程说明
"""
result = self._query_auth(authorization_code)
assert result is not None \
and 'authorization_info' in result \
... | [
"使用授权码换取公众号的授权信息",
"同时储存token信息"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/component.py#L361-L387 | [
"def",
"query_auth",
"(",
"self",
",",
"authorization_code",
")",
":",
"result",
"=",
"self",
".",
"_query_auth",
"(",
"authorization_code",
")",
"assert",
"result",
"is",
"not",
"None",
"and",
"'authorization_info'",
"in",
"result",
"and",
"'authorizer_appid'",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatComponent.refresh_authorizer_token | 获取(刷新)授权公众号的令牌
:params authorizer_appid: 授权方appid
:params authorizer_refresh_token: 授权方的刷新令牌 | wechatpy/component.py | def refresh_authorizer_token(
self, authorizer_appid, authorizer_refresh_token):
"""
获取(刷新)授权公众号的令牌
:params authorizer_appid: 授权方appid
:params authorizer_refresh_token: 授权方的刷新令牌
"""
return self.post(
'/component/api_authorizer_token',
... | def refresh_authorizer_token(
self, authorizer_appid, authorizer_refresh_token):
"""
获取(刷新)授权公众号的令牌
:params authorizer_appid: 授权方appid
:params authorizer_refresh_token: 授权方的刷新令牌
"""
return self.post(
'/component/api_authorizer_token',
... | [
"获取(刷新)授权公众号的令牌"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/component.py#L389-L404 | [
"def",
"refresh_authorizer_token",
"(",
"self",
",",
"authorizer_appid",
",",
"authorizer_refresh_token",
")",
":",
"return",
"self",
".",
"post",
"(",
"'/component/api_authorizer_token'",
",",
"data",
"=",
"{",
"'component_appid'",
":",
"self",
".",
"component_appid"... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatComponent.get_authorizer_option | 获取授权方的选项设置信息
:params authorizer_appid: 授权公众号appid
:params option_name: 选项名称 | wechatpy/component.py | def get_authorizer_option(self, authorizer_appid, option_name):
"""
获取授权方的选项设置信息
:params authorizer_appid: 授权公众号appid
:params option_name: 选项名称
"""
return self.post(
'/component/api_get_authorizer_option',
data={
'component_appid':... | def get_authorizer_option(self, authorizer_appid, option_name):
"""
获取授权方的选项设置信息
:params authorizer_appid: 授权公众号appid
:params option_name: 选项名称
"""
return self.post(
'/component/api_get_authorizer_option',
data={
'component_appid':... | [
"获取授权方的选项设置信息"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/component.py#L420-L434 | [
"def",
"get_authorizer_option",
"(",
"self",
",",
"authorizer_appid",
",",
"option_name",
")",
":",
"return",
"self",
".",
"post",
"(",
"'/component/api_get_authorizer_option'",
",",
"data",
"=",
"{",
"'component_appid'",
":",
"self",
".",
"component_appid",
",",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatComponent.set_authorizer_option | 设置授权方的选项信息
:params authorizer_appid: 授权公众号appid
:params option_name: 选项名称
:params option_value: 设置的选项值 | wechatpy/component.py | def set_authorizer_option(
self, authorizer_appid, option_name, option_value):
"""
设置授权方的选项信息
:params authorizer_appid: 授权公众号appid
:params option_name: 选项名称
:params option_value: 设置的选项值
"""
return self.post(
'/component/api_set_authorizer_... | def set_authorizer_option(
self, authorizer_appid, option_name, option_value):
"""
设置授权方的选项信息
:params authorizer_appid: 授权公众号appid
:params option_name: 选项名称
:params option_value: 设置的选项值
"""
return self.post(
'/component/api_set_authorizer_... | [
"设置授权方的选项信息"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/component.py#L436-L453 | [
"def",
"set_authorizer_option",
"(",
"self",
",",
"authorizer_appid",
",",
"option_name",
",",
"option_value",
")",
":",
"return",
"self",
".",
"post",
"(",
"'/component/api_set_authorizer_option'",
",",
"data",
"=",
"{",
"'component_appid'",
":",
"self",
".",
"co... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatComponent.get_client_by_authorization_code | 通过授权码直接获取 Client 对象
:params authorization_code: 授权code,会在授权成功时返回给第三方平台,详见第三方平台授权流程说明 | wechatpy/component.py | def get_client_by_authorization_code(self, authorization_code):
"""
通过授权码直接获取 Client 对象
:params authorization_code: 授权code,会在授权成功时返回给第三方平台,详见第三方平台授权流程说明
"""
warnings.warn('`get_client_by_authorization_code` method of `WeChatComponent` is deprecated,'
'Use `... | def get_client_by_authorization_code(self, authorization_code):
"""
通过授权码直接获取 Client 对象
:params authorization_code: 授权code,会在授权成功时返回给第三方平台,详见第三方平台授权流程说明
"""
warnings.warn('`get_client_by_authorization_code` method of `WeChatComponent` is deprecated,'
'Use `... | [
"通过授权码直接获取",
"Client",
"对象"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/component.py#L455-L472 | [
"def",
"get_client_by_authorization_code",
"(",
"self",
",",
"authorization_code",
")",
":",
"warnings",
".",
"warn",
"(",
"'`get_client_by_authorization_code` method of `WeChatComponent` is deprecated,'",
"'Use `parse_message` parse message and '",
"'Use `get_client_by_appid` instead'",... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatComponent.get_client_by_appid | 通过 authorizer_appid 获取 Client 对象
:params authorizer_appid: 授权公众号appid | wechatpy/component.py | def get_client_by_appid(self, authorizer_appid):
"""
通过 authorizer_appid 获取 Client 对象
:params authorizer_appid: 授权公众号appid
"""
access_token_key = '{0}_access_token'.format(authorizer_appid)
refresh_token_key = '{0}_refresh_token'.format(authorizer_appid)
access_t... | def get_client_by_appid(self, authorizer_appid):
"""
通过 authorizer_appid 获取 Client 对象
:params authorizer_appid: 授权公众号appid
"""
access_token_key = '{0}_access_token'.format(authorizer_appid)
refresh_token_key = '{0}_refresh_token'.format(authorizer_appid)
access_t... | [
"通过",
"authorizer_appid",
"获取",
"Client",
"对象"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/component.py#L474-L503 | [
"def",
"get_client_by_appid",
"(",
"self",
",",
"authorizer_appid",
")",
":",
"access_token_key",
"=",
"'{0}_access_token'",
".",
"format",
"(",
"authorizer_appid",
")",
"refresh_token_key",
"=",
"'{0}_refresh_token'",
".",
"format",
"(",
"authorizer_appid",
")",
"acc... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatComponent.parse_message | 处理 wechat server 推送消息
:params msg: 加密内容
:params msg_signature: 消息签名
:params timestamp: 时间戳
:params nonce: 随机数 | wechatpy/component.py | def parse_message(self, msg, msg_signature, timestamp, nonce):
"""
处理 wechat server 推送消息
:params msg: 加密内容
:params msg_signature: 消息签名
:params timestamp: 时间戳
:params nonce: 随机数
"""
content = self.crypto.decrypt_message(msg, msg_signature, timestamp, nonce... | def parse_message(self, msg, msg_signature, timestamp, nonce):
"""
处理 wechat server 推送消息
:params msg: 加密内容
:params msg_signature: 消息签名
:params timestamp: 时间戳
:params nonce: 随机数
"""
content = self.crypto.decrypt_message(msg, msg_signature, timestamp, nonce... | [
"处理",
"wechat",
"server",
"推送消息"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/component.py#L505-L523 | [
"def",
"parse_message",
"(",
"self",
",",
"msg",
",",
"msg_signature",
",",
"timestamp",
",",
"nonce",
")",
":",
"content",
"=",
"self",
".",
"crypto",
".",
"decrypt_message",
"(",
"msg",
",",
"msg_signature",
",",
"timestamp",
",",
"nonce",
")",
"message"... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatComponent.cache_component_verify_ticket | 处理 wechat server 推送的 component_verify_ticket消息
:params msg: 加密内容
:params signature: 消息签名
:params timestamp: 时间戳
:params nonce: 随机数 | wechatpy/component.py | def cache_component_verify_ticket(self, msg, signature, timestamp, nonce):
"""
处理 wechat server 推送的 component_verify_ticket消息
:params msg: 加密内容
:params signature: 消息签名
:params timestamp: 时间戳
:params nonce: 随机数
"""
warnings.warn('`cache_component_verify_ti... | def cache_component_verify_ticket(self, msg, signature, timestamp, nonce):
"""
处理 wechat server 推送的 component_verify_ticket消息
:params msg: 加密内容
:params signature: 消息签名
:params timestamp: 时间戳
:params nonce: 随机数
"""
warnings.warn('`cache_component_verify_ti... | [
"处理",
"wechat",
"server",
"推送的",
"component_verify_ticket消息"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/component.py#L525-L540 | [
"def",
"cache_component_verify_ticket",
"(",
"self",
",",
"msg",
",",
"signature",
",",
"timestamp",
",",
"nonce",
")",
":",
"warnings",
".",
"warn",
"(",
"'`cache_component_verify_ticket` method of `WeChatComponent` is deprecated,'",
"'Use `parse_message` instead'",
",",
"... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatComponent.get_unauthorized | 处理取消授权通知
:params msg: 加密内容
:params signature: 消息签名
:params timestamp: 时间戳
:params nonce: 随机数 | wechatpy/component.py | def get_unauthorized(self, msg, signature, timestamp, nonce):
"""
处理取消授权通知
:params msg: 加密内容
:params signature: 消息签名
:params timestamp: 时间戳
:params nonce: 随机数
"""
warnings.warn('`get_unauthorized` method of `WeChatComponent` is deprecated,'
... | def get_unauthorized(self, msg, signature, timestamp, nonce):
"""
处理取消授权通知
:params msg: 加密内容
:params signature: 消息签名
:params timestamp: 时间戳
:params nonce: 随机数
"""
warnings.warn('`get_unauthorized` method of `WeChatComponent` is deprecated,'
... | [
"处理取消授权通知"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/component.py#L542-L556 | [
"def",
"get_unauthorized",
"(",
"self",
",",
"msg",
",",
"signature",
",",
"timestamp",
",",
"nonce",
")",
":",
"warnings",
".",
"warn",
"(",
"'`get_unauthorized` method of `WeChatComponent` is deprecated,'",
"'Use `parse_message` instead'",
",",
"DeprecationWarning",
","... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | ComponentOAuth.fetch_access_token | 获取 access_token
:param code: 授权完成跳转回来后 URL 中的 code 参数
:return: JSON 数据包 | wechatpy/component.py | def fetch_access_token(self, code):
"""获取 access_token
:param code: 授权完成跳转回来后 URL 中的 code 参数
:return: JSON 数据包
"""
res = self._get(
'sns/oauth2/component/access_token',
params={
'appid': self.app_id,
'component_appid': self... | def fetch_access_token(self, code):
"""获取 access_token
:param code: 授权完成跳转回来后 URL 中的 code 参数
:return: JSON 数据包
"""
res = self._get(
'sns/oauth2/component/access_token',
params={
'appid': self.app_id,
'component_appid': self... | [
"获取",
"access_token"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/component.py#L624-L645 | [
"def",
"fetch_access_token",
"(",
"self",
",",
"code",
")",
":",
"res",
"=",
"self",
".",
"_get",
"(",
"'sns/oauth2/component/access_token'",
",",
"params",
"=",
"{",
"'appid'",
":",
"self",
".",
"app_id",
",",
"'component_appid'",
":",
"self",
".",
"compone... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | ComponentOAuth.get_user_info | 获取用户基本信息(需授权作用域为snsapi_userinfo)
如果网页授权作用域为snsapi_userinfo,则此时开发者可以通过access_token和openid拉取用户信息了。
:param openid: 可选,微信 openid,默认获取当前授权用户信息
:param access_token: 可选,access_token,默认使用当前授权用户的 access_token
:param lang: 可选,语言偏好, 默认为 ``zh_CN``
:return: JSON 数据包 | wechatpy/component.py | def get_user_info(self, openid=None, access_token=None, lang='zh_CN'):
""" 获取用户基本信息(需授权作用域为snsapi_userinfo)
如果网页授权作用域为snsapi_userinfo,则此时开发者可以通过access_token和openid拉取用户信息了。
:param openid: 可选,微信 openid,默认获取当前授权用户信息
:param access_token: 可选,access_token,默认使用当前授权用户的 access_token
:pa... | def get_user_info(self, openid=None, access_token=None, lang='zh_CN'):
""" 获取用户基本信息(需授权作用域为snsapi_userinfo)
如果网页授权作用域为snsapi_userinfo,则此时开发者可以通过access_token和openid拉取用户信息了。
:param openid: 可选,微信 openid,默认获取当前授权用户信息
:param access_token: 可选,access_token,默认使用当前授权用户的 access_token
:pa... | [
"获取用户基本信息(需授权作用域为snsapi_userinfo)"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/component.py#L670-L689 | [
"def",
"get_user_info",
"(",
"self",
",",
"openid",
"=",
"None",
",",
"access_token",
"=",
"None",
",",
"lang",
"=",
"'zh_CN'",
")",
":",
"openid",
"=",
"openid",
"or",
"self",
".",
"open_id",
"access_token",
"=",
"access_token",
"or",
"self",
".",
"acce... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatOAuth.authorize_url | 获取授权跳转地址
:return: URL 地址 | wechatpy/oauth.py | def authorize_url(self):
"""获取授权跳转地址
:return: URL 地址
"""
redirect_uri = quote(self.redirect_uri, safe=b'')
url_list = [
self.OAUTH_BASE_URL,
'oauth2/authorize?appid=',
self.app_id,
'&redirect_uri=',
redirect_uri,
... | def authorize_url(self):
"""获取授权跳转地址
:return: URL 地址
"""
redirect_uri = quote(self.redirect_uri, safe=b'')
url_list = [
self.OAUTH_BASE_URL,
'oauth2/authorize?appid=',
self.app_id,
'&redirect_uri=',
redirect_uri,
... | [
"获取授权跳转地址"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/oauth.py#L98-L116 | [
"def",
"authorize_url",
"(",
"self",
")",
":",
"redirect_uri",
"=",
"quote",
"(",
"self",
".",
"redirect_uri",
",",
"safe",
"=",
"b''",
")",
"url_list",
"=",
"[",
"self",
".",
"OAUTH_BASE_URL",
",",
"'oauth2/authorize?appid='",
",",
"self",
".",
"app_id",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatOAuth.fetch_access_token | 获取 access_token
:param code: 授权完成跳转回来后 URL 中的 code 参数
:return: JSON 数据包 | wechatpy/oauth.py | def fetch_access_token(self, code):
"""获取 access_token
:param code: 授权完成跳转回来后 URL 中的 code 参数
:return: JSON 数据包
"""
res = self._get(
'sns/oauth2/access_token',
params={
'appid': self.app_id,
'secret': self.secret,
... | def fetch_access_token(self, code):
"""获取 access_token
:param code: 授权完成跳转回来后 URL 中的 code 参数
:return: JSON 数据包
"""
res = self._get(
'sns/oauth2/access_token',
params={
'appid': self.app_id,
'secret': self.secret,
... | [
"获取",
"access_token"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/oauth.py#L139-L158 | [
"def",
"fetch_access_token",
"(",
"self",
",",
"code",
")",
":",
"res",
"=",
"self",
".",
"_get",
"(",
"'sns/oauth2/access_token'",
",",
"params",
"=",
"{",
"'appid'",
":",
"self",
".",
"app_id",
",",
"'secret'",
":",
"self",
".",
"secret",
",",
"'code'"... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatOAuth.refresh_access_token | 刷新 access token
:param refresh_token: OAuth2 refresh token
:return: JSON 数据包 | wechatpy/oauth.py | def refresh_access_token(self, refresh_token):
"""刷新 access token
:param refresh_token: OAuth2 refresh token
:return: JSON 数据包
"""
res = self._get(
'sns/oauth2/refresh_token',
params={
'appid': self.app_id,
'grant_type': 'r... | def refresh_access_token(self, refresh_token):
"""刷新 access token
:param refresh_token: OAuth2 refresh token
:return: JSON 数据包
"""
res = self._get(
'sns/oauth2/refresh_token',
params={
'appid': self.app_id,
'grant_type': 'r... | [
"刷新",
"access",
"token"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/oauth.py#L160-L178 | [
"def",
"refresh_access_token",
"(",
"self",
",",
"refresh_token",
")",
":",
"res",
"=",
"self",
".",
"_get",
"(",
"'sns/oauth2/refresh_token'",
",",
"params",
"=",
"{",
"'appid'",
":",
"self",
".",
"app_id",
",",
"'grant_type'",
":",
"'refresh_token'",
",",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatOAuth.check_access_token | 检查 access_token 有效性
:param openid: 可选,微信 openid,默认获取当前授权用户信息
:param access_token: 可选,access_token,默认使用当前授权用户的 access_token
:return: 有效返回 True,否则 False | wechatpy/oauth.py | def check_access_token(self, openid=None, access_token=None):
"""检查 access_token 有效性
:param openid: 可选,微信 openid,默认获取当前授权用户信息
:param access_token: 可选,access_token,默认使用当前授权用户的 access_token
:return: 有效返回 True,否则 False
"""
openid = openid or self.open_id
access_toke... | def check_access_token(self, openid=None, access_token=None):
"""检查 access_token 有效性
:param openid: 可选,微信 openid,默认获取当前授权用户信息
:param access_token: 可选,access_token,默认使用当前授权用户的 access_token
:return: 有效返回 True,否则 False
"""
openid = openid or self.open_id
access_toke... | [
"检查",
"access_token",
"有效性"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/oauth.py#L199-L217 | [
"def",
"check_access_token",
"(",
"self",
",",
"openid",
"=",
"None",
",",
"access_token",
"=",
"None",
")",
":",
"openid",
"=",
"openid",
"or",
"self",
".",
"open_id",
"access_token",
"=",
"access_token",
"or",
"self",
".",
"access_token",
"res",
"=",
"se... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatMaterial.add | 新增其它类型永久素材
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=%E4%B8%8A%E4%BC%A0%E6%B0%B8%E4%B9%85%E7%B4%A0%E6%9D%90
:param agent_id: 企业应用的id
:param media_type: 媒体文件类型,分别有图片(image)、语音(voice)、视频(video)普通文件(file)
:param media_file: 要上传的文件,一个 File-object
:return: 返回的 JS... | wechatpy/enterprise/client/api/material.py | def add(self, agent_id, media_type, media_file):
"""
新增其它类型永久素材
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=%E4%B8%8A%E4%BC%A0%E6%B0%B8%E4%B9%85%E7%B4%A0%E6%9D%90
:param agent_id: 企业应用的id
:param media_type: 媒体文件类型,分别有图片(image)、语音(voice)、视频(video)普通文件(file)
... | def add(self, agent_id, media_type, media_file):
"""
新增其它类型永久素材
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=%E4%B8%8A%E4%BC%A0%E6%B0%B8%E4%B9%85%E7%B4%A0%E6%9D%90
:param agent_id: 企业应用的id
:param media_type: 媒体文件类型,分别有图片(image)、语音(voice)、视频(video)普通文件(file)
... | [
"新增其它类型永久素材",
"详情请参考",
"https",
":",
"//",
"qydev",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"index",
".",
"php?title",
"=",
"%E4%B8%8A%E4%BC%A0%E6%B0%B8%E4%B9%85%E7%B4%A0%E6%9D%90"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/enterprise/client/api/material.py#L40-L61 | [
"def",
"add",
"(",
"self",
",",
"agent_id",
",",
"media_type",
",",
"media_file",
")",
":",
"params",
"=",
"{",
"'agentid'",
":",
"agent_id",
",",
"'type'",
":",
"media_type",
",",
"}",
"return",
"self",
".",
"_post",
"(",
"url",
"=",
"'material/add_mate... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatMaterial.get_url | 获取永久素材下载地址
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E6%B0%B8%E4%B9%85%E7%B4%A0%E6%9D%90
:param agent_id: 企业应用的id
:param media_id: 媒体文件 ID
:return: 临时素材下载地址 | wechatpy/enterprise/client/api/material.py | def get_url(self, agent_id, media_id):
"""
获取永久素材下载地址
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E6%B0%B8%E4%B9%85%E7%B4%A0%E6%9D%90
:param agent_id: 企业应用的id
:param media_id: 媒体文件 ID
:return: 临时素材下载地址
"""
parts = (
... | def get_url(self, agent_id, media_id):
"""
获取永久素材下载地址
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E6%B0%B8%E4%B9%85%E7%B4%A0%E6%9D%90
:param agent_id: 企业应用的id
:param media_id: 媒体文件 ID
:return: 临时素材下载地址
"""
parts = (
... | [
"获取永久素材下载地址",
"详情请参考",
"https",
":",
"//",
"qydev",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"index",
".",
"php?title",
"=",
"%E8%8E%B7%E5%8F%96%E6%B0%B8%E4%B9%85%E7%B4%A0%E6%9D%90"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/enterprise/client/api/material.py#L63-L82 | [
"def",
"get_url",
"(",
"self",
",",
"agent_id",
",",
"media_id",
")",
":",
"parts",
"=",
"(",
"'https://qyapi.weixin.qq.com/cgi-bin/material/get'",
",",
"'?access_token='",
",",
"self",
".",
"access_token",
",",
"'&media_id='",
",",
"media_id",
",",
"'&agentid='",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatMaterial.get | 获取永久素材
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E6%B0%B8%E4%B9%85%E7%B4%A0%E6%9D%90
:param agent_id: 企业应用的id
:param media_id: 媒体文件 ID
:return: requests 的 Response 实例 | wechatpy/enterprise/client/api/material.py | def get(self, agent_id, media_id):
"""
获取永久素材
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E6%B0%B8%E4%B9%85%E7%B4%A0%E6%9D%90
:param agent_id: 企业应用的id
:param media_id: 媒体文件 ID
:return: requests 的 Response 实例
"""
retur... | def get(self, agent_id, media_id):
"""
获取永久素材
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E6%B0%B8%E4%B9%85%E7%B4%A0%E6%9D%90
:param agent_id: 企业应用的id
:param media_id: 媒体文件 ID
:return: requests 的 Response 实例
"""
retur... | [
"获取永久素材",
"详情请参考",
"https",
":",
"//",
"qydev",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"index",
".",
"php?title",
"=",
"%E8%8E%B7%E5%8F%96%E6%B0%B8%E4%B9%85%E7%B4%A0%E6%9D%90"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/enterprise/client/api/material.py#L84-L94 | [
"def",
"get",
"(",
"self",
",",
"agent_id",
",",
"media_id",
")",
":",
"return",
"requests",
".",
"get",
"(",
"self",
".",
"get_url",
"(",
"agent_id",
",",
"media_id",
")",
")"
] | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatMaterial.update_articles | 修改永久图文素材
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=%E4%BF%AE%E6%94%B9%E6%B0%B8%E4%B9%85%E5%9B%BE%E6%96%87%E7%B4%A0%E6%9D%90
:param media_id: 要修改的图文消息的 id
:param index: 要更新的文章在图文消息中的位置(多图文消息时,此字段才有意义),第一篇为 0
:param articles: 图文素材数组
:return: 返回的 JSON 数据包 | wechatpy/enterprise/client/api/material.py | def update_articles(self, agent_id, media_id, articles):
"""
修改永久图文素材
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=%E4%BF%AE%E6%94%B9%E6%B0%B8%E4%B9%85%E5%9B%BE%E6%96%87%E7%B4%A0%E6%9D%90
:param media_id: 要修改的图文消息的 id
:param index: 要更新的文章在图文消息中的位置(多图文消息时,此字段才有意... | def update_articles(self, agent_id, media_id, articles):
"""
修改永久图文素材
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=%E4%BF%AE%E6%94%B9%E6%B0%B8%E4%B9%85%E5%9B%BE%E6%96%87%E7%B4%A0%E6%9D%90
:param media_id: 要修改的图文消息的 id
:param index: 要更新的文章在图文消息中的位置(多图文消息时,此字段才有意... | [
"修改永久图文素材",
"详情请参考",
"https",
":",
"//",
"qydev",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"index",
".",
"php?title",
"=",
"%E4%BF%AE%E6%94%B9%E6%B0%B8%E4%B9%85%E5%9B%BE%E6%96%87%E7%B4%A0%E6%9D%90"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/enterprise/client/api/material.py#L132-L161 | [
"def",
"update_articles",
"(",
"self",
",",
"agent_id",
",",
"media_id",
",",
"articles",
")",
":",
"articles_data",
"=",
"[",
"]",
"for",
"article",
"in",
"articles",
":",
"articles_data",
".",
"append",
"(",
"{",
"'thumb_media_id'",
":",
"article",
"[",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatMaterial.batchget | 批量获取永久素材列表
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E7%B4%A0%E6%9D%90%E5%88%97%E8%A1%A8
:param agent_id: 企业应用的id
:param media_type: 媒体文件类型,分别有图文(mpnews)、图片(image)、
语音(voice)、视频(video)和文件(file)
:param offset: 从全部素材的该偏移位置... | wechatpy/enterprise/client/api/material.py | def batchget(self, agent_id, media_type, offset=0, count=20):
"""
批量获取永久素材列表
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E7%B4%A0%E6%9D%90%E5%88%97%E8%A1%A8
:param agent_id: 企业应用的id
:param media_type: 媒体文件类型,分别有图文(mpnews)、图片(image)、
... | def batchget(self, agent_id, media_type, offset=0, count=20):
"""
批量获取永久素材列表
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=%E8%8E%B7%E5%8F%96%E7%B4%A0%E6%9D%90%E5%88%97%E8%A1%A8
:param agent_id: 企业应用的id
:param media_type: 媒体文件类型,分别有图文(mpnews)、图片(image)、
... | [
"批量获取永久素材列表",
"详情请参考",
"https",
":",
"//",
"qydev",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"index",
".",
"php?title",
"=",
"%E8%8E%B7%E5%8F%96%E7%B4%A0%E6%9D%90%E5%88%97%E8%A1%A8"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/enterprise/client/api/material.py#L179-L200 | [
"def",
"batchget",
"(",
"self",
",",
"agent_id",
",",
"media_type",
",",
"offset",
"=",
"0",
",",
"count",
"=",
"20",
")",
":",
"return",
"self",
".",
"_post",
"(",
"'material/batchget'",
",",
"data",
"=",
"{",
"'agent_id'",
":",
"agent_id",
",",
"'typ... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatMenu.create | 创建菜单
https://work.weixin.qq.com/api/doc#90000/90135/90231
:param agent_id: 应用id | wechatpy/enterprise/client/api/menu.py | def create(self, agent_id, menu_data):
"""
创建菜单
https://work.weixin.qq.com/api/doc#90000/90135/90231
:param agent_id: 应用id
"""
return self._post(
'menu/create',
params={
'agentid': agent_id
},
data=menu_dat... | def create(self, agent_id, menu_data):
"""
创建菜单
https://work.weixin.qq.com/api/doc#90000/90135/90231
:param agent_id: 应用id
"""
return self._post(
'menu/create',
params={
'agentid': agent_id
},
data=menu_dat... | [
"创建菜单"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/enterprise/client/api/menu.py#L14-L28 | [
"def",
"create",
"(",
"self",
",",
"agent_id",
",",
"menu_data",
")",
":",
"return",
"self",
".",
"_post",
"(",
"'menu/create'",
",",
"params",
"=",
"{",
"'agentid'",
":",
"agent_id",
"}",
",",
"data",
"=",
"menu_data",
")"
] | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatJSAPI.get_jsapi_ticket | 获取微信 JS-SDK ticket
该方法会通过 session 对象自动缓存管理 ticket
:return: ticket | wechatpy/client/api/jsapi.py | def get_jsapi_ticket(self):
"""
获取微信 JS-SDK ticket
该方法会通过 session 对象自动缓存管理 ticket
:return: ticket
"""
ticket_key = '{0}_jsapi_ticket'.format(self.appid)
expires_at_key = '{0}_jsapi_ticket_expires_at'.format(self.appid)
ticket = self.session.get(ticket_ke... | def get_jsapi_ticket(self):
"""
获取微信 JS-SDK ticket
该方法会通过 session 对象自动缓存管理 ticket
:return: ticket
"""
ticket_key = '{0}_jsapi_ticket'.format(self.appid)
expires_at_key = '{0}_jsapi_ticket_expires_at'.format(self.appid)
ticket = self.session.get(ticket_ke... | [
"获取微信",
"JS",
"-",
"SDK",
"ticket"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/jsapi.py#L33-L51 | [
"def",
"get_jsapi_ticket",
"(",
"self",
")",
":",
"ticket_key",
"=",
"'{0}_jsapi_ticket'",
".",
"format",
"(",
"self",
".",
"appid",
")",
"expires_at_key",
"=",
"'{0}_jsapi_ticket_expires_at'",
".",
"format",
"(",
"self",
".",
"appid",
")",
"ticket",
"=",
"sel... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatJSAPI.get_jsapi_card_ticket | 获取 api_ticket:是用于调用微信卡券JS API的临时票据,有效期为7200 秒,通过access_token 来获取。
微信文档地址:http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html
该方法会通过 session 对象自动缓存管理 ticket
:return: ticket | wechatpy/client/api/jsapi.py | def get_jsapi_card_ticket(self):
"""
获取 api_ticket:是用于调用微信卡券JS API的临时票据,有效期为7200 秒,通过access_token 来获取。
微信文档地址:http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html
该方法会通过 session 对象自动缓存管理 ticket
:return: ticket
"""
jsapi_card_ticket_key = '{0}_jsap... | def get_jsapi_card_ticket(self):
"""
获取 api_ticket:是用于调用微信卡券JS API的临时票据,有效期为7200 秒,通过access_token 来获取。
微信文档地址:http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html
该方法会通过 session 对象自动缓存管理 ticket
:return: ticket
"""
jsapi_card_ticket_key = '{0}_jsap... | [
"获取",
"api_ticket:是用于调用微信卡券JS",
"API的临时票据,有效期为7200",
"秒,通过access_token",
"来获取。",
"微信文档地址:http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"7",
"/",
"aaa137b55fb2e0456bf8dd9148dd613f",
".",
"html",
"该方法会通过",
"session",
"对象自动缓存管理",
"ti... | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/jsapi.py#L73-L92 | [
"def",
"get_jsapi_card_ticket",
"(",
"self",
")",
":",
"jsapi_card_ticket_key",
"=",
"'{0}_jsapi_card_ticket'",
".",
"format",
"(",
"self",
".",
"appid",
")",
"jsapi_card_ticket_expire_at_key",
"=",
"'{0}_jsapi_card_ticket_expires_at'",
".",
"format",
"(",
"self",
".",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatJSAPI.get_jsapi_card_params | 参数意义见微信文档地址:http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html
:param card_ticket: 用于卡券的微信 api_ticket
:param card_type:
:param kwargs: 非必须参数:noncestr, timestamp, code, openid, fixed_begintimestamp, outer_str
:return: 包含调用jssdk所有所需参数的 dict | wechatpy/client/api/jsapi.py | def get_jsapi_card_params(self, card_ticket, card_type, **kwargs):
"""
参数意义见微信文档地址:http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html
:param card_ticket: 用于卡券的微信 api_ticket
:param card_type:
:param kwargs: 非必须参数:noncestr, timestamp, code, openid, fixed_begintim... | def get_jsapi_card_params(self, card_ticket, card_type, **kwargs):
"""
参数意义见微信文档地址:http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html
:param card_ticket: 用于卡券的微信 api_ticket
:param card_type:
:param kwargs: 非必须参数:noncestr, timestamp, code, openid, fixed_begintim... | [
"参数意义见微信文档地址:http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"7",
"/",
"aaa137b55fb2e0456bf8dd9148dd613f",
".",
"html",
":",
"param",
"card_ticket",
":",
"用于卡券的微信",
"api_ticket",
":",
"param",
"card_type",
":",
":",
"param",
... | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/jsapi.py#L94-L112 | [
"def",
"get_jsapi_card_params",
"(",
"self",
",",
"card_ticket",
",",
"card_type",
",",
"*",
"*",
"kwargs",
")",
":",
"card_signature_dict",
"=",
"{",
"'card_type'",
":",
"card_type",
",",
"'noncestr'",
":",
"kwargs",
".",
"get",
"(",
"'noncestr'",
",",
"ran... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatInvoice.create_card | 创建发票卡券模板
注意这里的对象和会员卡有类似之处,但是含义有不同。创建发票卡券模板是创建发票卡券的基础。
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1496561481_1TyO7
:param base_info:发票卡券模板基础信息
:type base_info: dict
:param payee: 收款方(开票方)全称,显示在发票详情内。建议一个收款方对应一个发票卡券模板
:param invoice_type: 发票类型描述
:param detail... | wechatpy/client/api/invoice.py | def create_card(self, base_info, payee, invoice_type, detail=None):
"""
创建发票卡券模板
注意这里的对象和会员卡有类似之处,但是含义有不同。创建发票卡券模板是创建发票卡券的基础。
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1496561481_1TyO7
:param base_info:发票卡券模板基础信息
:type base_info: dict
:param payee: 收款方(开票方... | def create_card(self, base_info, payee, invoice_type, detail=None):
"""
创建发票卡券模板
注意这里的对象和会员卡有类似之处,但是含义有不同。创建发票卡券模板是创建发票卡券的基础。
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1496561481_1TyO7
:param base_info:发票卡券模板基础信息
:type base_info: dict
:param payee: 收款方(开票方... | [
"创建发票卡券模板",
"注意这里的对象和会员卡有类似之处,但是含义有不同。创建发票卡券模板是创建发票卡券的基础。",
"详情请参考",
"https",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki?id",
"=",
"mp1496561481_1TyO7"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/invoice.py#L24-L49 | [
"def",
"create_card",
"(",
"self",
",",
"base_info",
",",
"payee",
",",
"invoice_type",
",",
"detail",
"=",
"None",
")",
":",
"return",
"self",
".",
"_post",
"(",
"'platform/createcard'",
",",
"data",
"=",
"{",
"'invoice_info'",
":",
"{",
"'base_info'",
":... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatInvoice.get_auth_url | 获取授权页链接
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1497082828_r1cI2
:param s_pappid: 开票平台在微信的标识号,商户需要找开票平台提供
:param order_id: 订单id,在商户内单笔开票请求的唯一识别号
:param money: 订单金额,以分为单位
:type money: int
:param timestamp: Unix 时间戳
:type timestamp: int
:param sour... | wechatpy/client/api/invoice.py | def get_auth_url(self, s_pappid, order_id, money, timestamp, source, ticket, auth_type, redirect_url=None):
"""
获取授权页链接
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1497082828_r1cI2
:param s_pappid: 开票平台在微信的标识号,商户需要找开票平台提供
:param order_id: 订单id,在商户内单笔开票请求的唯一识别号
:para... | def get_auth_url(self, s_pappid, order_id, money, timestamp, source, ticket, auth_type, redirect_url=None):
"""
获取授权页链接
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1497082828_r1cI2
:param s_pappid: 开票平台在微信的标识号,商户需要找开票平台提供
:param order_id: 订单id,在商户内单笔开票请求的唯一识别号
:para... | [
"获取授权页链接",
"详情请参考",
"https",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki?id",
"=",
"mp1497082828_r1cI2"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/invoice.py#L51-L89 | [
"def",
"get_auth_url",
"(",
"self",
",",
"s_pappid",
",",
"order_id",
",",
"money",
",",
"timestamp",
",",
"source",
",",
"ticket",
",",
"auth_type",
",",
"redirect_url",
"=",
"None",
")",
":",
"if",
"source",
"not",
"in",
"{",
"'app'",
",",
"'web'",
"... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatInvoice.set_auth_field | 设置授权页字段信息
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1497082828_r1cI2
:param user_field: 授权页个人发票字段
:type user_field: dict
:param biz_field: 授权页单位发票字段
:type biz_field: dict | wechatpy/client/api/invoice.py | def set_auth_field(self, user_field, biz_field):
"""
设置授权页字段信息
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1497082828_r1cI2
:param user_field: 授权页个人发票字段
:type user_field: dict
:param biz_field: 授权页单位发票字段
:type biz_field: dict
"""
return self.... | def set_auth_field(self, user_field, biz_field):
"""
设置授权页字段信息
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1497082828_r1cI2
:param user_field: 授权页个人发票字段
:type user_field: dict
:param biz_field: 授权页单位发票字段
:type biz_field: dict
"""
return self.... | [
"设置授权页字段信息",
"详情请参考",
"https",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki?id",
"=",
"mp1497082828_r1cI2"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/invoice.py#L91-L113 | [
"def",
"set_auth_field",
"(",
"self",
",",
"user_field",
",",
"biz_field",
")",
":",
"return",
"self",
".",
"_post",
"(",
"'setbizattr'",
",",
"params",
"=",
"{",
"'action'",
":",
"'set_auth_field'",
",",
"}",
",",
"data",
"=",
"{",
"'auth_field'",
":",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatInvoice.reject_insert | 拒绝用户的开发票请求
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1497082828_r1cI2
:param s_pappid: 开票平台在微信的标识号,商户需要找开票平台提供
:param order_id: 订单id,在商户内单笔开票请求的唯一识别号
:param reason: 拒绝原因
:param redirect_url: 跳转链接 | wechatpy/client/api/invoice.py | def reject_insert(self, s_pappid, order_id, reason, redirect_url=None):
"""
拒绝用户的开发票请求
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1497082828_r1cI2
:param s_pappid: 开票平台在微信的标识号,商户需要找开票平台提供
:param order_id: 订单id,在商户内单笔开票请求的唯一识别号
:param reason: 拒绝原因
:param red... | def reject_insert(self, s_pappid, order_id, reason, redirect_url=None):
"""
拒绝用户的开发票请求
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1497082828_r1cI2
:param s_pappid: 开票平台在微信的标识号,商户需要找开票平台提供
:param order_id: 订单id,在商户内单笔开票请求的唯一识别号
:param reason: 拒绝原因
:param red... | [
"拒绝用户的开发票请求",
"详情请参考",
"https",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki?id",
"=",
"mp1497082828_r1cI2"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/invoice.py#L151-L170 | [
"def",
"reject_insert",
"(",
"self",
",",
"s_pappid",
",",
"order_id",
",",
"reason",
",",
"redirect_url",
"=",
"None",
")",
":",
"return",
"self",
".",
"_post",
"(",
"'rejectinsert'",
",",
"data",
"=",
"{",
"'s_pappid'",
":",
"s_pappid",
",",
"'order_id'"... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatInvoice.insert | 制作发票卡券,并放入用户卡包
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1497082828_r1cI2
:param order_id: 订单id,在商户内单笔开票请求的唯一识别号
:param card_id: 发票卡券模板的编号
:param appid: 商户 AppID
:param card_ext: 发票具体内容
:type card_ext: dict
:return: 随机防重字符串,以及用户 Open ID | wechatpy/client/api/invoice.py | def insert(self, order_id, card_id, appid, card_ext):
"""
制作发票卡券,并放入用户卡包
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1497082828_r1cI2
:param order_id: 订单id,在商户内单笔开票请求的唯一识别号
:param card_id: 发票卡券模板的编号
:param appid: 商户 AppID
:param card_ext: 发票具体内容
:typ... | def insert(self, order_id, card_id, appid, card_ext):
"""
制作发票卡券,并放入用户卡包
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1497082828_r1cI2
:param order_id: 订单id,在商户内单笔开票请求的唯一识别号
:param card_id: 发票卡券模板的编号
:param appid: 商户 AppID
:param card_ext: 发票具体内容
:typ... | [
"制作发票卡券,并放入用户卡包",
"详情请参考",
"https",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki?id",
"=",
"mp1497082828_r1cI2"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/invoice.py#L172-L193 | [
"def",
"insert",
"(",
"self",
",",
"order_id",
",",
"card_id",
",",
"appid",
",",
"card_ext",
")",
":",
"return",
"self",
".",
"_post",
"(",
"'insert'",
",",
"data",
"=",
"{",
"'order_id'",
":",
"order_id",
",",
"'card_id'",
":",
"card_id",
",",
"'appi... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatInvoice.upload_pdf | 上传电子发票中的消费凭证 PDF
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1497082828_r1cI2
:param pdf: 要上传的 PDF 文件,一个 File-object
:return: 64位整数,在将发票卡券插入用户卡包时使用用于关联pdf和发票卡券。有效期为3天。 | wechatpy/client/api/invoice.py | def upload_pdf(self, pdf):
"""
上传电子发票中的消费凭证 PDF
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1497082828_r1cI2
:param pdf: 要上传的 PDF 文件,一个 File-object
:return: 64位整数,在将发票卡券插入用户卡包时使用用于关联pdf和发票卡券。有效期为3天。
"""
return self._post(
'platform/setpdf',
... | def upload_pdf(self, pdf):
"""
上传电子发票中的消费凭证 PDF
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1497082828_r1cI2
:param pdf: 要上传的 PDF 文件,一个 File-object
:return: 64位整数,在将发票卡券插入用户卡包时使用用于关联pdf和发票卡券。有效期为3天。
"""
return self._post(
'platform/setpdf',
... | [
"上传电子发票中的消费凭证",
"PDF",
"详情请参考",
"https",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki?id",
"=",
"mp1497082828_r1cI2"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/invoice.py#L195-L210 | [
"def",
"upload_pdf",
"(",
"self",
",",
"pdf",
")",
":",
"return",
"self",
".",
"_post",
"(",
"'platform/setpdf'",
",",
"files",
"=",
"{",
"'pdf'",
":",
"pdf",
",",
"}",
",",
"result_processor",
"=",
"lambda",
"x",
":",
"x",
"[",
"'s_media_id'",
"]",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatInvoice.update_status | 更新发票卡券的状态
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1497082828_r1cI2
:param card_id: 发票卡券模板的编号
:param code: 发票卡券的编号
:param reimburse_status: 发票报销状态 | wechatpy/client/api/invoice.py | def update_status(self, card_id, code, reimburse_status):
"""
更新发票卡券的状态
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1497082828_r1cI2
:param card_id: 发票卡券模板的编号
:param code: 发票卡券的编号
:param reimburse_status: 发票报销状态
"""
return self._post(
'pl... | def update_status(self, card_id, code, reimburse_status):
"""
更新发票卡券的状态
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1497082828_r1cI2
:param card_id: 发票卡券模板的编号
:param code: 发票卡券的编号
:param reimburse_status: 发票报销状态
"""
return self._post(
'pl... | [
"更新发票卡券的状态",
"详情请参考",
"https",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki?id",
"=",
"mp1497082828_r1cI2"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/invoice.py#L232-L249 | [
"def",
"update_status",
"(",
"self",
",",
"card_id",
",",
"code",
",",
"reimburse_status",
")",
":",
"return",
"self",
".",
"_post",
"(",
"'platform/updatestatus'",
",",
"data",
"=",
"{",
"'card_id'",
":",
"card_id",
",",
"'code'",
":",
"code",
",",
"'reim... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatInvoice.set_pay_mch | 关联商户号与开票平台,设置支付后开票
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1496561731_2Z55U
:param mchid: 微信支付商户号
:param s_pappid: 开票平台在微信的标识号,商户需要找开票平台提供 | wechatpy/client/api/invoice.py | def set_pay_mch(self, mchid, s_pappid):
"""
关联商户号与开票平台,设置支付后开票
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1496561731_2Z55U
:param mchid: 微信支付商户号
:param s_pappid: 开票平台在微信的标识号,商户需要找开票平台提供
"""
return self._post(
'setbizattr',
params={
... | def set_pay_mch(self, mchid, s_pappid):
"""
关联商户号与开票平台,设置支付后开票
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1496561731_2Z55U
:param mchid: 微信支付商户号
:param s_pappid: 开票平台在微信的标识号,商户需要找开票平台提供
"""
return self._post(
'setbizattr',
params={
... | [
"关联商户号与开票平台,设置支付后开票",
"详情请参考",
"https",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki?id",
"=",
"mp1496561731_2Z55U"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/invoice.py#L251-L271 | [
"def",
"set_pay_mch",
"(",
"self",
",",
"mchid",
",",
"s_pappid",
")",
":",
"return",
"self",
".",
"_post",
"(",
"'setbizattr'",
",",
"params",
"=",
"{",
"'action'",
":",
"'set_pay_mch'",
",",
"}",
",",
"data",
"=",
"{",
"'paymch_info'",
":",
"{",
"'mc... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatInvoice.update_reimburse | 报销方更新发票信息
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1496561749_f7T6D
:param card_id: 发票卡券的 Card ID
:param encrypt_code: 发票卡券的加密 Code
:param reimburse_status: 发票报销状态 | wechatpy/client/api/invoice.py | def update_reimburse(self, card_id, encrypt_code, reimburse_status):
"""
报销方更新发票信息
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1496561749_f7T6D
:param card_id: 发票卡券的 Card ID
:param encrypt_code: 发票卡券的加密 Code
:param reimburse_status: 发票报销状态
"""
return... | def update_reimburse(self, card_id, encrypt_code, reimburse_status):
"""
报销方更新发票信息
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1496561749_f7T6D
:param card_id: 发票卡券的 Card ID
:param encrypt_code: 发票卡券的加密 Code
:param reimburse_status: 发票报销状态
"""
return... | [
"报销方更新发票信息",
"详情请参考",
"https",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki?id",
"=",
"mp1496561749_f7T6D"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/invoice.py#L309-L326 | [
"def",
"update_reimburse",
"(",
"self",
",",
"card_id",
",",
"encrypt_code",
",",
"reimburse_status",
")",
":",
"return",
"self",
".",
"_post",
"(",
"'reimburse/updateinvoicestatus'",
",",
"data",
"=",
"{",
"'card_id'",
":",
"card_id",
",",
"'encrypt_code'",
":"... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatInvoice.batch_update_reimburse | 报销方批量更新发票信息
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1496561749_f7T6D
:param openid: 用户的 Open ID
:param reimburse_status: 发票报销状态
:param invoice_list: 发票列表
:type invoice_list: list[dict] | wechatpy/client/api/invoice.py | def batch_update_reimburse(self, openid, reimburse_status, invoice_list):
"""
报销方批量更新发票信息
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1496561749_f7T6D
:param openid: 用户的 Open ID
:param reimburse_status: 发票报销状态
:param invoice_list: 发票列表
:type invoice_list: li... | def batch_update_reimburse(self, openid, reimburse_status, invoice_list):
"""
报销方批量更新发票信息
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1496561749_f7T6D
:param openid: 用户的 Open ID
:param reimburse_status: 发票报销状态
:param invoice_list: 发票列表
:type invoice_list: li... | [
"报销方批量更新发票信息",
"详情请参考",
"https",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki?id",
"=",
"mp1496561749_f7T6D"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/invoice.py#L328-L346 | [
"def",
"batch_update_reimburse",
"(",
"self",
",",
"openid",
",",
"reimburse_status",
",",
"invoice_list",
")",
":",
"return",
"self",
".",
"_post",
"(",
"'reimburse/updatestatusbatch'",
",",
"data",
"=",
"{",
"'openid'",
":",
"openid",
",",
"'reimburse_status'",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatInvoice.get_user_title_url | 获取添加发票链接
获取链接,发送给用户。用户同意以后,发票抬头信息将会录入到用户微信中
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1496554912_vfWU0
:param user_fill: 企业设置抬头为0,用户自己填写抬头为1
:type user_fill: bool
:param title: 抬头,当 user_fill 为 False 时必填
:param phone: 联系方式
:param tax_no: 税号
:param ... | wechatpy/client/api/invoice.py | def get_user_title_url(
self, user_fill, title=None, phone=None, tax_no=None, addr=None, bank_type=None, bank_no=None,
out_title_id=None):
"""
获取添加发票链接
获取链接,发送给用户。用户同意以后,发票抬头信息将会录入到用户微信中
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1496554912_vfWU0
:p... | def get_user_title_url(
self, user_fill, title=None, phone=None, tax_no=None, addr=None, bank_type=None, bank_no=None,
out_title_id=None):
"""
获取添加发票链接
获取链接,发送给用户。用户同意以后,发票抬头信息将会录入到用户微信中
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1496554912_vfWU0
:p... | [
"获取添加发票链接",
"获取链接,发送给用户。用户同意以后,发票抬头信息将会录入到用户微信中",
"详情请参考",
"https",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki?id",
"=",
"mp1496554912_vfWU0"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/invoice.py#L348-L383 | [
"def",
"get_user_title_url",
"(",
"self",
",",
"user_fill",
",",
"title",
"=",
"None",
",",
"phone",
"=",
"None",
",",
"tax_no",
"=",
"None",
",",
"addr",
"=",
"None",
",",
"bank_type",
"=",
"None",
",",
"bank_no",
"=",
"None",
",",
"out_title_id",
"="... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatInvoice.get_select_title_url | 获取商户专属开票链接
商户调用接口,获取链接。用户扫码,可以选择抬头发给商户。可以将链接转成二维码,立在收银台。
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1496554912_vfWU0
:param attach: 附加字段,用户提交发票时会发送给商户
:return: 商户专属开票链接 | wechatpy/client/api/invoice.py | def get_select_title_url(self, attach=None):
"""
获取商户专属开票链接
商户调用接口,获取链接。用户扫码,可以选择抬头发给商户。可以将链接转成二维码,立在收银台。
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1496554912_vfWU0
:param attach: 附加字段,用户提交发票时会发送给商户
:return: 商户专属开票链接
"""
return self._post(
... | def get_select_title_url(self, attach=None):
"""
获取商户专属开票链接
商户调用接口,获取链接。用户扫码,可以选择抬头发给商户。可以将链接转成二维码,立在收银台。
详情请参考
https://mp.weixin.qq.com/wiki?id=mp1496554912_vfWU0
:param attach: 附加字段,用户提交发票时会发送给商户
:return: 商户专属开票链接
"""
return self._post(
... | [
"获取商户专属开票链接",
"商户调用接口,获取链接。用户扫码,可以选择抬头发给商户。可以将链接转成二维码,立在收银台。",
"详情请参考",
"https",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki?id",
"=",
"mp1496554912_vfWU0"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/invoice.py#L385-L401 | [
"def",
"get_select_title_url",
"(",
"self",
",",
"attach",
"=",
"None",
")",
":",
"return",
"self",
".",
"_post",
"(",
"'biz/getselecttitleurl'",
",",
"data",
"=",
"{",
"'attach'",
":",
"attach",
",",
"}",
",",
"result_processor",
"=",
"lambda",
"x",
":",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatMedia.upload | 上传临时素材
详情请参考
http://mp.weixin.qq.com/wiki/5/963fc70b80dc75483a271298a76a8d59.html
:param media_type: 媒体文件类型,分别有图片(image)、语音(voice)、视频(video)和缩略图(thumb)
:param media_file: 要上传的文件,一个 File-object
:return: 返回的 JSON 数据包 | wechatpy/client/api/media.py | def upload(self, media_type, media_file):
"""
上传临时素材
详情请参考
http://mp.weixin.qq.com/wiki/5/963fc70b80dc75483a271298a76a8d59.html
:param media_type: 媒体文件类型,分别有图片(image)、语音(voice)、视频(video)和缩略图(thumb)
:param media_file: 要上传的文件,一个 File-object
:return: 返回的 JSON 数据包
... | def upload(self, media_type, media_file):
"""
上传临时素材
详情请参考
http://mp.weixin.qq.com/wiki/5/963fc70b80dc75483a271298a76a8d59.html
:param media_type: 媒体文件类型,分别有图片(image)、语音(voice)、视频(video)和缩略图(thumb)
:param media_file: 要上传的文件,一个 File-object
:return: 返回的 JSON 数据包
... | [
"上传临时素材",
"详情请参考",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"5",
"/",
"963fc70b80dc75483a271298a76a8d59",
".",
"html"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/media.py#L8-L27 | [
"def",
"upload",
"(",
"self",
",",
"media_type",
",",
"media_file",
")",
":",
"return",
"self",
".",
"_post",
"(",
"url",
"=",
"'media/upload'",
",",
"params",
"=",
"{",
"'type'",
":",
"media_type",
"}",
",",
"files",
"=",
"{",
"'media'",
":",
"media_f... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatMedia.upload_video | 群发视频消息时获取视频 media_id
详情请参考
http://mp.weixin.qq.com/wiki/15/5380a4e6f02f2ffdc7981a8ed7a40753.html
:param media_id: 需通过基础支持中的上传下载多媒体文件 :func:`upload` 来得到
:param title: 视频标题
:param description: 视频描述
:return: 返回的 JSON 数据包 | wechatpy/client/api/media.py | def upload_video(self, media_id, title, description):
"""
群发视频消息时获取视频 media_id
详情请参考
http://mp.weixin.qq.com/wiki/15/5380a4e6f02f2ffdc7981a8ed7a40753.html
:param media_id: 需通过基础支持中的上传下载多媒体文件 :func:`upload` 来得到
:param title: 视频标题
:param description: 视频描述
... | def upload_video(self, media_id, title, description):
"""
群发视频消息时获取视频 media_id
详情请参考
http://mp.weixin.qq.com/wiki/15/5380a4e6f02f2ffdc7981a8ed7a40753.html
:param media_id: 需通过基础支持中的上传下载多媒体文件 :func:`upload` 来得到
:param title: 视频标题
:param description: 视频描述
... | [
"群发视频消息时获取视频",
"media_id",
"详情请参考",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"15",
"/",
"5380a4e6f02f2ffdc7981a8ed7a40753",
".",
"html"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/media.py#L62-L81 | [
"def",
"upload_video",
"(",
"self",
",",
"media_id",
",",
"title",
",",
"description",
")",
":",
"return",
"self",
".",
"_post",
"(",
"url",
"=",
"'media/uploadvideo'",
",",
"data",
"=",
"{",
"'media_id'",
":",
"media_id",
",",
"'title'",
":",
"title",
"... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatMedia.upload_image | 上传群发消息内的图片
详情请参考
http://mp.weixin.qq.com/wiki/15/5380a4e6f02f2ffdc7981a8ed7a40753.html
:param media_file: 要上传的文件,一个 File-object
:return: 上传成功时返回图片 URL | wechatpy/client/api/media.py | def upload_image(self, media_file):
"""
上传群发消息内的图片
详情请参考
http://mp.weixin.qq.com/wiki/15/5380a4e6f02f2ffdc7981a8ed7a40753.html
:param media_file: 要上传的文件,一个 File-object
:return: 上传成功时返回图片 URL
"""
res = self._post(
url='media/uploadimg',
... | def upload_image(self, media_file):
"""
上传群发消息内的图片
详情请参考
http://mp.weixin.qq.com/wiki/15/5380a4e6f02f2ffdc7981a8ed7a40753.html
:param media_file: 要上传的文件,一个 File-object
:return: 上传成功时返回图片 URL
"""
res = self._post(
url='media/uploadimg',
... | [
"上传群发消息内的图片",
"详情请参考",
"http",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki",
"/",
"15",
"/",
"5380a4e6f02f2ffdc7981a8ed7a40753",
".",
"html"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/media.py#L110-L126 | [
"def",
"upload_image",
"(",
"self",
",",
"media_file",
")",
":",
"res",
"=",
"self",
".",
"_post",
"(",
"url",
"=",
"'media/uploadimg'",
",",
"files",
"=",
"{",
"'media'",
":",
"media_file",
"}",
",",
"result_processor",
"=",
"lambda",
"x",
":",
"x",
"... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | rsa_encrypt | rsa 加密
:param data: 待加密字符串/binary
:param pem: RSA public key 内容/binary
:param b64_encode: 是否对输出进行 base64 encode
:return: 如果 b64_encode=True 的话,返回加密并 base64 处理后的 string;否则返回加密后的 binary | wechatpy/pay/utils.py | def rsa_encrypt(data, pem, b64_encode=True):
"""
rsa 加密
:param data: 待加密字符串/binary
:param pem: RSA public key 内容/binary
:param b64_encode: 是否对输出进行 base64 encode
:return: 如果 b64_encode=True 的话,返回加密并 base64 处理后的 string;否则返回加密后的 binary
"""
from cryptography.hazmat.backends import default_ba... | def rsa_encrypt(data, pem, b64_encode=True):
"""
rsa 加密
:param data: 待加密字符串/binary
:param pem: RSA public key 内容/binary
:param b64_encode: 是否对输出进行 base64 encode
:return: 如果 b64_encode=True 的话,返回加密并 base64 处理后的 string;否则返回加密后的 binary
"""
from cryptography.hazmat.backends import default_ba... | [
"rsa",
"加密",
":",
"param",
"data",
":",
"待加密字符串",
"/",
"binary",
":",
"param",
"pem",
":",
"RSA",
"public",
"key",
"内容",
"/",
"binary",
":",
"param",
"b64_encode",
":",
"是否对输出进行",
"base64",
"encode",
":",
"return",
":",
"如果",
"b64_encode",
"=",
"True",... | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/pay/utils.py#L69-L94 | [
"def",
"rsa_encrypt",
"(",
"data",
",",
"pem",
",",
"b64_encode",
"=",
"True",
")",
":",
"from",
"cryptography",
".",
"hazmat",
".",
"backends",
"import",
"default_backend",
"from",
"cryptography",
".",
"hazmat",
".",
"primitives",
"import",
"serialization",
"... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | rsa_decrypt | rsa 解密
:param encrypted_data: 待解密 bytes
:param pem: RSA private key 内容/binary
:param password: RSA private key pass phrase
:return: 解密后的 binary | wechatpy/pay/utils.py | def rsa_decrypt(encrypted_data, pem, password=None):
"""
rsa 解密
:param encrypted_data: 待解密 bytes
:param pem: RSA private key 内容/binary
:param password: RSA private key pass phrase
:return: 解密后的 binary
"""
from cryptography.hazmat.backends import default_backend
from cryptography.hazm... | def rsa_decrypt(encrypted_data, pem, password=None):
"""
rsa 解密
:param encrypted_data: 待解密 bytes
:param pem: RSA private key 内容/binary
:param password: RSA private key pass phrase
:return: 解密后的 binary
"""
from cryptography.hazmat.backends import default_backend
from cryptography.hazm... | [
"rsa",
"解密",
":",
"param",
"encrypted_data",
":",
"待解密",
"bytes",
":",
"param",
"pem",
":",
"RSA",
"private",
"key",
"内容",
"/",
"binary",
":",
"param",
"password",
":",
"RSA",
"private",
"key",
"pass",
"phrase",
":",
"return",
":",
"解密后的",
"binary"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/pay/utils.py#L97-L121 | [
"def",
"rsa_decrypt",
"(",
"encrypted_data",
",",
"pem",
",",
"password",
"=",
"None",
")",
":",
"from",
"cryptography",
".",
"hazmat",
".",
"backends",
"import",
"default_backend",
"from",
"cryptography",
".",
"hazmat",
".",
"primitives",
"import",
"serializati... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatRedpack.send | 发送现金红包
:param user_id: 接收红包的用户在公众号下的 openid
:param total_amount: 红包金额,单位分
:param send_name: 商户名称
:param act_name: 活动名称
:param wishing: 红包祝福语
:param remark: 备注
:param client_ip: 可选,调用接口的机器 IP 地址
:param total_num: 可选,红包发放总人数,默认为 1
:param out_trade_n... | wechatpy/pay/api/redpack.py | def send(self, user_id, total_amount, send_name, act_name,
wishing, remark, total_num=1, client_ip=None,
out_trade_no=None, scene_id=None, consume_mch_id=None):
"""
发送现金红包
:param user_id: 接收红包的用户在公众号下的 openid
:param total_amount: 红包金额,单位分
:param send_na... | def send(self, user_id, total_amount, send_name, act_name,
wishing, remark, total_num=1, client_ip=None,
out_trade_no=None, scene_id=None, consume_mch_id=None):
"""
发送现金红包
:param user_id: 接收红包的用户在公众号下的 openid
:param total_amount: 红包金额,单位分
:param send_na... | [
"发送现金红包"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/pay/api/redpack.py#L12-L53 | [
"def",
"send",
"(",
"self",
",",
"user_id",
",",
"total_amount",
",",
"send_name",
",",
"act_name",
",",
"wishing",
",",
"remark",
",",
"total_num",
"=",
"1",
",",
"client_ip",
"=",
"None",
",",
"out_trade_no",
"=",
"None",
",",
"scene_id",
"=",
"None",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatRedpack.query | 查询红包发放记录
:param out_trade_no: 商户订单号
:param bill_type: 可选,订单类型,目前固定为 MCHT
:return: 返回的红包发放记录信息 | wechatpy/pay/api/redpack.py | def query(self, out_trade_no, bill_type='MCHT'):
"""
查询红包发放记录
:param out_trade_no: 商户订单号
:param bill_type: 可选,订单类型,目前固定为 MCHT
:return: 返回的红包发放记录信息
"""
data = {
'mch_billno': out_trade_no,
'bill_type': bill_type,
'appid': self.a... | def query(self, out_trade_no, bill_type='MCHT'):
"""
查询红包发放记录
:param out_trade_no: 商户订单号
:param bill_type: 可选,订单类型,目前固定为 MCHT
:return: 返回的红包发放记录信息
"""
data = {
'mch_billno': out_trade_no,
'bill_type': bill_type,
'appid': self.a... | [
"查询红包发放记录"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/pay/api/redpack.py#L101-L114 | [
"def",
"query",
"(",
"self",
",",
"out_trade_no",
",",
"bill_type",
"=",
"'MCHT'",
")",
":",
"data",
"=",
"{",
"'mch_billno'",
":",
"out_trade_no",
",",
"'bill_type'",
":",
"bill_type",
",",
"'appid'",
":",
"self",
".",
"appid",
",",
"}",
"return",
"self... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatChat.create | 创建会话
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=企业会话接口说明
:param chat_id: 会话id。字符串类型,最长32个字符。只允许字符0-9及字母a-zA-Z,
如果值内容为64bit无符号整型:要求值范围在[1, 2^63)之间,
[2^63, 2^64)为系统分配会话id区间
:param name: 会话标题
:param owner: 管理员userid,必须是该会... | wechatpy/enterprise/client/api/chat.py | def create(self, chat_id, name, owner, user_list):
"""
创建会话
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=企业会话接口说明
:param chat_id: 会话id。字符串类型,最长32个字符。只允许字符0-9及字母a-zA-Z,
如果值内容为64bit无符号整型:要求值范围在[1, 2^63)之间,
[2^63, 2^64)为系统分... | def create(self, chat_id, name, owner, user_list):
"""
创建会话
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=企业会话接口说明
:param chat_id: 会话id。字符串类型,最长32个字符。只允许字符0-9及字母a-zA-Z,
如果值内容为64bit无符号整型:要求值范围在[1, 2^63)之间,
[2^63, 2^64)为系统分... | [
"创建会话"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/enterprise/client/api/chat.py#L14-L37 | [
"def",
"create",
"(",
"self",
",",
"chat_id",
",",
"name",
",",
"owner",
",",
"user_list",
")",
":",
"return",
"self",
".",
"_post",
"(",
"'chat/create'",
",",
"data",
"=",
"{",
"'chatid'",
":",
"chat_id",
",",
"'name'",
":",
"name",
",",
"'owner'",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatChat.update | 修改会话
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=企业会话接口说明
:param chat_id: 会话 ID
:param op_user: 操作人 userid
:param name: 会话标题
:param owner: 管理员userid,必须是该会话userlist的成员之一
:param add_user_list: 会话新增成员列表,成员用userid来标识
:param del_user_list: 会话退出成员列表... | wechatpy/enterprise/client/api/chat.py | def update(self, chat_id, op_user, name=None, owner=None,
add_user_list=None, del_user_list=None):
"""
修改会话
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=企业会话接口说明
:param chat_id: 会话 ID
:param op_user: 操作人 userid
:param name: 会话标题
... | def update(self, chat_id, op_user, name=None, owner=None,
add_user_list=None, del_user_list=None):
"""
修改会话
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=企业会话接口说明
:param chat_id: 会话 ID
:param op_user: 操作人 userid
:param name: 会话标题
... | [
"修改会话"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/enterprise/client/api/chat.py#L52-L76 | [
"def",
"update",
"(",
"self",
",",
"chat_id",
",",
"op_user",
",",
"name",
"=",
"None",
",",
"owner",
"=",
"None",
",",
"add_user_list",
"=",
"None",
",",
"del_user_list",
"=",
"None",
")",
":",
"data",
"=",
"optionaldict",
"(",
"chatid",
"=",
"chat_id... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatChat.clear_notify | 清除会话未读状态
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=企业会话接口说明
:param op_user: 会话所有者的userid
:param type: 会话类型:single|group,分别表示:单聊|群聊
:param id: 会话值,为userid|chatid,分别表示:成员id|会话id
:return: 返回的 JSON 数据包 | wechatpy/enterprise/client/api/chat.py | def clear_notify(self, op_user, type, id):
"""
清除会话未读状态
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=企业会话接口说明
:param op_user: 会话所有者的userid
:param type: 会话类型:single|group,分别表示:单聊|群聊
:param id: 会话值,为userid|chatid,分别表示:成员id|会话id
:return: 返回的 JSON ... | def clear_notify(self, op_user, type, id):
"""
清除会话未读状态
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=企业会话接口说明
:param op_user: 会话所有者的userid
:param type: 会话类型:single|group,分别表示:单聊|群聊
:param id: 会话值,为userid|chatid,分别表示:成员id|会话id
:return: 返回的 JSON ... | [
"清除会话未读状态"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/enterprise/client/api/chat.py#L97-L118 | [
"def",
"clear_notify",
"(",
"self",
",",
"op_user",
",",
"type",
",",
"id",
")",
":",
"return",
"self",
".",
"_post",
"(",
"'chat/clearnotify'",
",",
"data",
"=",
"{",
"'op_user'",
":",
"op_user",
",",
"'chat'",
":",
"{",
"'type'",
":",
"type",
",",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatChat.send_text | 发送文本消息
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=企业会话接口说明
:param sender: 发送人
:param receiver_type: 接收人类型:single|group,分别表示:单聊|群聊
:param receiver_id: 接收人的值,为userid|chatid,分别表示:成员id|会话id
:param content: 消息内容
:return: 返回的 JSON 数据包 | wechatpy/enterprise/client/api/chat.py | def send_text(self, sender, receiver_type, receiver_id, content):
"""
发送文本消息
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=企业会话接口说明
:param sender: 发送人
:param receiver_type: 接收人类型:single|group,分别表示:单聊|群聊
:param receiver_id: 接收人的值,为userid|chatid,分别表示:成员id... | def send_text(self, sender, receiver_type, receiver_id, content):
"""
发送文本消息
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=企业会话接口说明
:param sender: 发送人
:param receiver_type: 接收人类型:single|group,分别表示:单聊|群聊
:param receiver_id: 接收人的值,为userid|chatid,分别表示:成员id... | [
"发送文本消息"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/enterprise/client/api/chat.py#L135-L159 | [
"def",
"send_text",
"(",
"self",
",",
"sender",
",",
"receiver_type",
",",
"receiver_id",
",",
"content",
")",
":",
"data",
"=",
"{",
"'receiver'",
":",
"{",
"'type'",
":",
"receiver_type",
",",
"'id'",
":",
"receiver_id",
",",
"}",
",",
"'sender'",
":",... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatChat.send_single_text | 发送单聊文本消息
:param sender: 发送人
:param receiver: 接收人成员 ID
:param content: 消息内容
:return: 返回的 JSON 数据包 | wechatpy/enterprise/client/api/chat.py | def send_single_text(self, sender, receiver, content):
"""
发送单聊文本消息
:param sender: 发送人
:param receiver: 接收人成员 ID
:param content: 消息内容
:return: 返回的 JSON 数据包
"""
return self.send_text(sender, 'single', receiver, content) | def send_single_text(self, sender, receiver, content):
"""
发送单聊文本消息
:param sender: 发送人
:param receiver: 接收人成员 ID
:param content: 消息内容
:return: 返回的 JSON 数据包
"""
return self.send_text(sender, 'single', receiver, content) | [
"发送单聊文本消息"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/enterprise/client/api/chat.py#L161-L170 | [
"def",
"send_single_text",
"(",
"self",
",",
"sender",
",",
"receiver",
",",
"content",
")",
":",
"return",
"self",
".",
"send_text",
"(",
"sender",
",",
"'single'",
",",
"receiver",
",",
"content",
")"
] | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatChat.send_group_text | 发送群聊文本消息
:param sender: 发送人
:param receiver: 会话 ID
:param content: 消息内容
:return: 返回的 JSON 数据包 | wechatpy/enterprise/client/api/chat.py | def send_group_text(self, sender, receiver, content):
"""
发送群聊文本消息
:param sender: 发送人
:param receiver: 会话 ID
:param content: 消息内容
:return: 返回的 JSON 数据包
"""
return self.send_text(sender, 'group', receiver, content) | def send_group_text(self, sender, receiver, content):
"""
发送群聊文本消息
:param sender: 发送人
:param receiver: 会话 ID
:param content: 消息内容
:return: 返回的 JSON 数据包
"""
return self.send_text(sender, 'group', receiver, content) | [
"发送群聊文本消息"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/enterprise/client/api/chat.py#L172-L181 | [
"def",
"send_group_text",
"(",
"self",
",",
"sender",
",",
"receiver",
",",
"content",
")",
":",
"return",
"self",
".",
"send_text",
"(",
"sender",
",",
"'group'",
",",
"receiver",
",",
"content",
")"
] | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatChat.send_image | 发送图片消息
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=企业会话接口说明
:param sender: 发送人
:param receiver_type: 接收人类型:single|group,分别表示:单聊|群聊
:param receiver_id: 接收人的值,为userid|chatid,分别表示:成员id|会话id
:param media_id: 图片媒体文件id,可以调用上传素材文件接口获取
:return: 返回的 JSON 数据包 | wechatpy/enterprise/client/api/chat.py | def send_image(self, sender, receiver_type, receiver_id, media_id):
"""
发送图片消息
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=企业会话接口说明
:param sender: 发送人
:param receiver_type: 接收人类型:single|group,分别表示:单聊|群聊
:param receiver_id: 接收人的值,为userid|chatid,分别表示:成员... | def send_image(self, sender, receiver_type, receiver_id, media_id):
"""
发送图片消息
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=企业会话接口说明
:param sender: 发送人
:param receiver_type: 接收人类型:single|group,分别表示:单聊|群聊
:param receiver_id: 接收人的值,为userid|chatid,分别表示:成员... | [
"发送图片消息"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/enterprise/client/api/chat.py#L183-L207 | [
"def",
"send_image",
"(",
"self",
",",
"sender",
",",
"receiver_type",
",",
"receiver_id",
",",
"media_id",
")",
":",
"data",
"=",
"{",
"'receiver'",
":",
"{",
"'type'",
":",
"receiver_type",
",",
"'id'",
":",
"receiver_id",
",",
"}",
",",
"'sender'",
":... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatChat.send_single_image | 发送单聊图片消息
:param sender: 发送人
:param receiver: 接收人成员 ID
:param media_id: 图片媒体文件id,可以调用上传素材文件接口获取
:return: 返回的 JSON 数据包 | wechatpy/enterprise/client/api/chat.py | def send_single_image(self, sender, receiver, media_id):
"""
发送单聊图片消息
:param sender: 发送人
:param receiver: 接收人成员 ID
:param media_id: 图片媒体文件id,可以调用上传素材文件接口获取
:return: 返回的 JSON 数据包
"""
return self.send_image(sender, 'single', receiver, media_id) | def send_single_image(self, sender, receiver, media_id):
"""
发送单聊图片消息
:param sender: 发送人
:param receiver: 接收人成员 ID
:param media_id: 图片媒体文件id,可以调用上传素材文件接口获取
:return: 返回的 JSON 数据包
"""
return self.send_image(sender, 'single', receiver, media_id) | [
"发送单聊图片消息"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/enterprise/client/api/chat.py#L209-L218 | [
"def",
"send_single_image",
"(",
"self",
",",
"sender",
",",
"receiver",
",",
"media_id",
")",
":",
"return",
"self",
".",
"send_image",
"(",
"sender",
",",
"'single'",
",",
"receiver",
",",
"media_id",
")"
] | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatChat.send_group_image | 发送群聊图片消息
:param sender: 发送人
:param receiver: 会话 ID
:param media_id: 图片媒体文件id,可以调用上传素材文件接口获取
:return: 返回的 JSON 数据包 | wechatpy/enterprise/client/api/chat.py | def send_group_image(self, sender, receiver, media_id):
"""
发送群聊图片消息
:param sender: 发送人
:param receiver: 会话 ID
:param media_id: 图片媒体文件id,可以调用上传素材文件接口获取
:return: 返回的 JSON 数据包
"""
return self.send_image(sender, 'group', receiver, media_id) | def send_group_image(self, sender, receiver, media_id):
"""
发送群聊图片消息
:param sender: 发送人
:param receiver: 会话 ID
:param media_id: 图片媒体文件id,可以调用上传素材文件接口获取
:return: 返回的 JSON 数据包
"""
return self.send_image(sender, 'group', receiver, media_id) | [
"发送群聊图片消息"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/enterprise/client/api/chat.py#L220-L229 | [
"def",
"send_group_image",
"(",
"self",
",",
"sender",
",",
"receiver",
",",
"media_id",
")",
":",
"return",
"self",
".",
"send_image",
"(",
"sender",
",",
"'group'",
",",
"receiver",
",",
"media_id",
")"
] | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatChat.send_file | 发送文件消息
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=企业会话接口说明
:param sender: 发送人
:param receiver_type: 接收人类型:single|group,分别表示:单聊|群聊
:param receiver_id: 接收人的值,为userid|chatid,分别表示:成员id|会话id
:param media_id: 文件id,可以调用上传素材文件接口获取, 文件须大于4字节
:return: 返回的 JSON... | wechatpy/enterprise/client/api/chat.py | def send_file(self, sender, receiver_type, receiver_id, media_id):
"""
发送文件消息
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=企业会话接口说明
:param sender: 发送人
:param receiver_type: 接收人类型:single|group,分别表示:单聊|群聊
:param receiver_id: 接收人的值,为userid|chatid,分别表示:成员i... | def send_file(self, sender, receiver_type, receiver_id, media_id):
"""
发送文件消息
详情请参考
https://qydev.weixin.qq.com/wiki/index.php?title=企业会话接口说明
:param sender: 发送人
:param receiver_type: 接收人类型:single|group,分别表示:单聊|群聊
:param receiver_id: 接收人的值,为userid|chatid,分别表示:成员i... | [
"发送文件消息"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/enterprise/client/api/chat.py#L231-L255 | [
"def",
"send_file",
"(",
"self",
",",
"sender",
",",
"receiver_type",
",",
"receiver_id",
",",
"media_id",
")",
":",
"data",
"=",
"{",
"'receiver'",
":",
"{",
"'type'",
":",
"receiver_type",
",",
"'id'",
":",
"receiver_id",
",",
"}",
",",
"'sender'",
":"... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatChat.send_single_file | 发送单聊文件消息
:param sender: 发送人
:param receiver: 接收人成员 ID
:param media_id: 文件id,可以调用上传素材文件接口获取, 文件须大于4字节
:return: 返回的 JSON 数据包 | wechatpy/enterprise/client/api/chat.py | def send_single_file(self, sender, receiver, media_id):
"""
发送单聊文件消息
:param sender: 发送人
:param receiver: 接收人成员 ID
:param media_id: 文件id,可以调用上传素材文件接口获取, 文件须大于4字节
:return: 返回的 JSON 数据包
"""
return self.send_file(sender, 'single', receiver, media_id) | def send_single_file(self, sender, receiver, media_id):
"""
发送单聊文件消息
:param sender: 发送人
:param receiver: 接收人成员 ID
:param media_id: 文件id,可以调用上传素材文件接口获取, 文件须大于4字节
:return: 返回的 JSON 数据包
"""
return self.send_file(sender, 'single', receiver, media_id) | [
"发送单聊文件消息"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/enterprise/client/api/chat.py#L257-L266 | [
"def",
"send_single_file",
"(",
"self",
",",
"sender",
",",
"receiver",
",",
"media_id",
")",
":",
"return",
"self",
".",
"send_file",
"(",
"sender",
",",
"'single'",
",",
"receiver",
",",
"media_id",
")"
] | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatChat.send_group_file | 发送群聊文件消息
:param sender: 发送人
:param receiver: 会话 ID
:param media_id: 文件id,可以调用上传素材文件接口获取, 文件须大于4字节
:return: 返回的 JSON 数据包 | wechatpy/enterprise/client/api/chat.py | def send_group_file(self, sender, receiver, media_id):
"""
发送群聊文件消息
:param sender: 发送人
:param receiver: 会话 ID
:param media_id: 文件id,可以调用上传素材文件接口获取, 文件须大于4字节
:return: 返回的 JSON 数据包
"""
return self.send_file(sender, 'group', receiver, media_id) | def send_group_file(self, sender, receiver, media_id):
"""
发送群聊文件消息
:param sender: 发送人
:param receiver: 会话 ID
:param media_id: 文件id,可以调用上传素材文件接口获取, 文件须大于4字节
:return: 返回的 JSON 数据包
"""
return self.send_file(sender, 'group', receiver, media_id) | [
"发送群聊文件消息"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/enterprise/client/api/chat.py#L268-L277 | [
"def",
"send_group_file",
"(",
"self",
",",
"sender",
",",
"receiver",
",",
"media_id",
")",
":",
"return",
"self",
".",
"send_file",
"(",
"sender",
",",
"'group'",
",",
"receiver",
",",
"media_id",
")"
] | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatCoupon.send | 发放代金券
:param user_id: 用户在公众号下的 openid
:param stock_id: 代金券批次 ID
:param op_user_id: 可选,操作员账号,默认为商户号
:param device_info: 可选,微信支付分配的终端设备号
:param out_trade_no: 可选,商户订单号,需保持唯一性,默认自动生成
:return: 返回的结果信息 | wechatpy/pay/api/coupon.py | def send(self, user_id, stock_id, op_user_id=None, device_info=None,
out_trade_no=None):
"""
发放代金券
:param user_id: 用户在公众号下的 openid
:param stock_id: 代金券批次 ID
:param op_user_id: 可选,操作员账号,默认为商户号
:param device_info: 可选,微信支付分配的终端设备号
:param out_trade_no: 可... | def send(self, user_id, stock_id, op_user_id=None, device_info=None,
out_trade_no=None):
"""
发放代金券
:param user_id: 用户在公众号下的 openid
:param stock_id: 代金券批次 ID
:param op_user_id: 可选,操作员账号,默认为商户号
:param device_info: 可选,微信支付分配的终端设备号
:param out_trade_no: 可... | [
"发放代金券"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/pay/api/coupon.py#L11-L41 | [
"def",
"send",
"(",
"self",
",",
"user_id",
",",
"stock_id",
",",
"op_user_id",
"=",
"None",
",",
"device_info",
"=",
"None",
",",
"out_trade_no",
"=",
"None",
")",
":",
"if",
"not",
"out_trade_no",
":",
"now",
"=",
"datetime",
".",
"now",
"(",
")",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatCoupon.query_stock | 查询代金券批次
:param stock_id: 代金券批次 ID
:param op_user_id: 可选,操作员账号,默认为商户号
:param device_info: 可选,微信支付分配的终端设备号
:return: 返回的结果信息 | wechatpy/pay/api/coupon.py | def query_stock(self, stock_id, op_user_id=None, device_info=None):
"""
查询代金券批次
:param stock_id: 代金券批次 ID
:param op_user_id: 可选,操作员账号,默认为商户号
:param device_info: 可选,微信支付分配的终端设备号
:return: 返回的结果信息
"""
data = {
'appid': self.appid,
'co... | def query_stock(self, stock_id, op_user_id=None, device_info=None):
"""
查询代金券批次
:param stock_id: 代金券批次 ID
:param op_user_id: 可选,操作员账号,默认为商户号
:param device_info: 可选,微信支付分配的终端设备号
:return: 返回的结果信息
"""
data = {
'appid': self.appid,
'co... | [
"查询代金券批次"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/pay/api/coupon.py#L43-L60 | [
"def",
"query_stock",
"(",
"self",
",",
"stock_id",
",",
"op_user_id",
"=",
"None",
",",
"device_info",
"=",
"None",
")",
":",
"data",
"=",
"{",
"'appid'",
":",
"self",
".",
"appid",
",",
"'coupon_stock_id'",
":",
"stock_id",
",",
"'op_user_id'",
":",
"o... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatCoupon.query_coupon | 查询代金券信息
:param coupon_id: 代金券 ID
:param user_id: 用户在公众号下的 openid
:param op_user_id: 可选,操作员账号,默认为商户号
:param device_info: 可选,微信支付分配的终端设备号
:return: 返回的结果信息 | wechatpy/pay/api/coupon.py | def query_coupon(self, coupon_id, user_id,
op_user_id=None, device_info=None):
"""
查询代金券信息
:param coupon_id: 代金券 ID
:param user_id: 用户在公众号下的 openid
:param op_user_id: 可选,操作员账号,默认为商户号
:param device_info: 可选,微信支付分配的终端设备号
:return: 返回的结果信息
... | def query_coupon(self, coupon_id, user_id,
op_user_id=None, device_info=None):
"""
查询代金券信息
:param coupon_id: 代金券 ID
:param user_id: 用户在公众号下的 openid
:param op_user_id: 可选,操作员账号,默认为商户号
:param device_info: 可选,微信支付分配的终端设备号
:return: 返回的结果信息
... | [
"查询代金券信息"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/pay/api/coupon.py#L62-L82 | [
"def",
"query_coupon",
"(",
"self",
",",
"coupon_id",
",",
"user_id",
",",
"op_user_id",
"=",
"None",
",",
"device_info",
"=",
"None",
")",
":",
"data",
"=",
"{",
"'coupon_id'",
":",
"coupon_id",
",",
"'openid'",
":",
"user_id",
",",
"'appid'",
":",
"sel... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatMarketing.add_user_action_sets | 创建数据源
https://wximg.qq.com/wxp/pdftool/get.html?id=rkalQXDBM&pa=39
:param _type: 用户行为源类型
:param name: 用户行为源名称 必填
:param description: 用户行为源描述,字段长度最小 1 字节,长度最大 128 字节
:param version: 版本号 v1.0
:return: 数据源唯一ID | wechatpy/client/api/marketing.py | def add_user_action_sets(self, _type, name, description, version='v1.0'):
"""
创建数据源
https://wximg.qq.com/wxp/pdftool/get.html?id=rkalQXDBM&pa=39
:param _type: 用户行为源类型
:param name: 用户行为源名称 必填
:param description: 用户行为源描述,字段长度最小 1 字节,长度最大 128 字节
:param version: 版本号 ... | def add_user_action_sets(self, _type, name, description, version='v1.0'):
"""
创建数据源
https://wximg.qq.com/wxp/pdftool/get.html?id=rkalQXDBM&pa=39
:param _type: 用户行为源类型
:param name: 用户行为源名称 必填
:param description: 用户行为源描述,字段长度最小 1 字节,长度最大 128 字节
:param version: 版本号 ... | [
"创建数据源",
"https",
":",
"//",
"wximg",
".",
"qq",
".",
"com",
"/",
"wxp",
"/",
"pdftool",
"/",
"get",
".",
"html?id",
"=",
"rkalQXDBM&pa",
"=",
"39"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/marketing.py#L15-L36 | [
"def",
"add_user_action_sets",
"(",
"self",
",",
"_type",
",",
"name",
",",
"description",
",",
"version",
"=",
"'v1.0'",
")",
":",
"return",
"self",
".",
"_post",
"(",
"'user_action_sets/add'",
",",
"params",
"=",
"{",
"'version'",
":",
"version",
"}",
",... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatMarketing.get_user_action_sets | 获取数据源信息
:param user_action_set_id: 数据源唯一ID
:param version: 版本号 v1.0 | wechatpy/client/api/marketing.py | def get_user_action_sets(self, user_action_set_id, version='v1.0'):
"""
获取数据源信息
:param user_action_set_id: 数据源唯一ID
:param version: 版本号 v1.0
"""
return self._get(
'user_action_sets/get',
params={'version': version, 'user_action_set_id': user_action... | def get_user_action_sets(self, user_action_set_id, version='v1.0'):
"""
获取数据源信息
:param user_action_set_id: 数据源唯一ID
:param version: 版本号 v1.0
"""
return self._get(
'user_action_sets/get',
params={'version': version, 'user_action_set_id': user_action... | [
"获取数据源信息"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/marketing.py#L38-L49 | [
"def",
"get_user_action_sets",
"(",
"self",
",",
"user_action_set_id",
",",
"version",
"=",
"'v1.0'",
")",
":",
"return",
"self",
".",
"_get",
"(",
"'user_action_sets/get'",
",",
"params",
"=",
"{",
"'version'",
":",
"version",
",",
"'user_action_set_id'",
":",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatMarketing.add_user_actions | 回传数据
https://wximg.qq.com/wxp/pdftool/get.html?id=rkalQXDBM&pa=39
:param actions: 用户行为源类型
:param version: 版本号 v1.0 | wechatpy/client/api/marketing.py | def add_user_actions(self, actions=(), version='v1.0'):
"""
回传数据
https://wximg.qq.com/wxp/pdftool/get.html?id=rkalQXDBM&pa=39
:param actions: 用户行为源类型
:param version: 版本号 v1.0
"""
return self._post(
'user_actions/add',
params={'version': v... | def add_user_actions(self, actions=(), version='v1.0'):
"""
回传数据
https://wximg.qq.com/wxp/pdftool/get.html?id=rkalQXDBM&pa=39
:param actions: 用户行为源类型
:param version: 版本号 v1.0
"""
return self._post(
'user_actions/add',
params={'version': v... | [
"回传数据"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/marketing.py#L51-L64 | [
"def",
"add_user_actions",
"(",
"self",
",",
"actions",
"=",
"(",
")",
",",
"version",
"=",
"'v1.0'",
")",
":",
"return",
"self",
".",
"_post",
"(",
"'user_actions/add'",
",",
"params",
"=",
"{",
"'version'",
":",
"version",
"}",
",",
"json",
"=",
"{",... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatMarketing.get_ad_leads | 获取朋友圈销售线索数据接口
:param start_date: 开始日期 默认今天
:param end_date: 结束日期 默认今天
:param filtering: 过滤条件 [{field: 过滤字段, operator: 操作符, values: 字段取值}]
:param page: 页码,获取指定页数据
:param page_size: 一页获取的数据条数(1-100)
:param version: 版本号 v1.0 | wechatpy/client/api/marketing.py | def get_ad_leads(self, start_date=None, end_date=None, filtering=(), page=1, page_size=100, version='v1.0'):
"""
获取朋友圈销售线索数据接口
:param start_date: 开始日期 默认今天
:param end_date: 结束日期 默认今天
:param filtering: 过滤条件 [{field: 过滤字段, operator: 操作符, values: 字段取值}]
:param page: 页码,获取指... | def get_ad_leads(self, start_date=None, end_date=None, filtering=(), page=1, page_size=100, version='v1.0'):
"""
获取朋友圈销售线索数据接口
:param start_date: 开始日期 默认今天
:param end_date: 结束日期 默认今天
:param filtering: 过滤条件 [{field: 过滤字段, operator: 操作符, values: 字段取值}]
:param page: 页码,获取指... | [
"获取朋友圈销售线索数据接口"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/marketing.py#L66-L97 | [
"def",
"get_ad_leads",
"(",
"self",
",",
"start_date",
"=",
"None",
",",
"end_date",
"=",
"None",
",",
"filtering",
"=",
"(",
")",
",",
"page",
"=",
"1",
",",
"page_size",
"=",
"100",
",",
"version",
"=",
"'v1.0'",
")",
":",
"today",
"=",
"datetime",... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatOrder.create | 统一下单接口
:param trade_type: 交易类型,取值如下:JSAPI,NATIVE,APP,WAP, MWEB
:param body: 商品描述
:param total_fee: 总金额,单位分
:param notify_url: 接收微信支付异步通知回调地址
:param client_ip: 可选,APP和网页支付提交用户端ip,Native支付填调用微信支付API的机器IP
:param user_id: 可选,用户在商户appid下的唯一标识。trade_type=JSAPI和appid已设定,此参数必传
... | wechatpy/pay/api/order.py | def create(self, trade_type, body, total_fee, notify_url, client_ip=None,
user_id=None, out_trade_no=None, detail=None, attach=None,
fee_type='CNY', time_start=None, time_expire=None, goods_tag=None,
product_id=None, device_info=None, limit_pay=None, scene_info=None, sub_use... | def create(self, trade_type, body, total_fee, notify_url, client_ip=None,
user_id=None, out_trade_no=None, detail=None, attach=None,
fee_type='CNY', time_start=None, time_expire=None, goods_tag=None,
product_id=None, device_info=None, limit_pay=None, scene_info=None, sub_use... | [
"统一下单接口"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/pay/api/order.py#L16-L80 | [
"def",
"create",
"(",
"self",
",",
"trade_type",
",",
"body",
",",
"total_fee",
",",
"notify_url",
",",
"client_ip",
"=",
"None",
",",
"user_id",
"=",
"None",
",",
"out_trade_no",
"=",
"None",
",",
"detail",
"=",
"None",
",",
"attach",
"=",
"None",
","... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatOrder.close | 关闭订单
:param out_trade_no: 商户系统内部的订单号
:return: 返回的结果数据 | wechatpy/pay/api/order.py | def close(self, out_trade_no):
"""
关闭订单
:param out_trade_no: 商户系统内部的订单号
:return: 返回的结果数据
"""
data = {
'appid': self.appid,
'out_trade_no': out_trade_no,
}
return self._post('pay/closeorder', data=data) | def close(self, out_trade_no):
"""
关闭订单
:param out_trade_no: 商户系统内部的订单号
:return: 返回的结果数据
"""
data = {
'appid': self.appid,
'out_trade_no': out_trade_no,
}
return self._post('pay/closeorder', data=data) | [
"关闭订单"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/pay/api/order.py#L97-L108 | [
"def",
"close",
"(",
"self",
",",
"out_trade_no",
")",
":",
"data",
"=",
"{",
"'appid'",
":",
"self",
".",
"appid",
",",
"'out_trade_no'",
":",
"out_trade_no",
",",
"}",
"return",
"self",
".",
"_post",
"(",
"'pay/closeorder'",
",",
"data",
"=",
"data",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatOrder.get_appapi_params | 获取 APP 支付参数
:param prepay_id: 统一下单接口返回的 prepay_id 参数值
:param timestamp: 可选,时间戳,默认为当前时间戳
:param nonce_str: 可选,随机字符串,默认自动生成
:return: 签名 | wechatpy/pay/api/order.py | def get_appapi_params(self, prepay_id, timestamp=None, nonce_str=None):
"""
获取 APP 支付参数
:param prepay_id: 统一下单接口返回的 prepay_id 参数值
:param timestamp: 可选,时间戳,默认为当前时间戳
:param nonce_str: 可选,随机字符串,默认自动生成
:return: 签名
"""
data = {
'appid': self.appid,... | def get_appapi_params(self, prepay_id, timestamp=None, nonce_str=None):
"""
获取 APP 支付参数
:param prepay_id: 统一下单接口返回的 prepay_id 参数值
:param timestamp: 可选,时间戳,默认为当前时间戳
:param nonce_str: 可选,随机字符串,默认自动生成
:return: 签名
"""
data = {
'appid': self.appid,... | [
"获取",
"APP",
"支付参数"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/pay/api/order.py#L110-L129 | [
"def",
"get_appapi_params",
"(",
"self",
",",
"prepay_id",
",",
"timestamp",
"=",
"None",
",",
"nonce_str",
"=",
"None",
")",
":",
"data",
"=",
"{",
"'appid'",
":",
"self",
".",
"appid",
",",
"'partnerid'",
":",
"self",
".",
"mch_id",
",",
"'prepayid'",
... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatOrder.reverse | 撤销订单
:param transaction_id: 可选,微信的订单号,优先使用
:param out_trade_no: 可选,商户系统内部的订单号,
transaction_id、out_trade_no二选一,
如果同时存在优先级:transaction_id> out_trade_no
:return: 返回的结果数据 | wechatpy/pay/api/order.py | def reverse(self, transaction_id=None, out_trade_no=None):
"""
撤销订单
:param transaction_id: 可选,微信的订单号,优先使用
:param out_trade_no: 可选,商户系统内部的订单号,
transaction_id、out_trade_no二选一,
如果同时存在优先级:transaction_id> out_trade_no
:return: 返... | def reverse(self, transaction_id=None, out_trade_no=None):
"""
撤销订单
:param transaction_id: 可选,微信的订单号,优先使用
:param out_trade_no: 可选,商户系统内部的订单号,
transaction_id、out_trade_no二选一,
如果同时存在优先级:transaction_id> out_trade_no
:return: 返... | [
"撤销订单"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/pay/api/order.py#L131-L146 | [
"def",
"reverse",
"(",
"self",
",",
"transaction_id",
"=",
"None",
",",
"out_trade_no",
"=",
"None",
")",
":",
"data",
"=",
"{",
"'appid'",
":",
"self",
".",
"appid",
",",
"'transaction_id'",
":",
"transaction_id",
",",
"'out_trade_no'",
":",
"out_trade_no",... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatUser.get | 获取用户基本信息(包括UnionID机制)
详情请参考
https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140839
:param user_id: 普通用户的标识,对当前公众号唯一
:param lang: 返回国家地区语言版本,zh_CN 简体,zh_TW 繁体,en 英语
:return: 返回的 JSON 数据包
使用示例::
from wechatpy import WeChatClient
client... | wechatpy/client/api/user.py | def get(self, user_id, lang='zh_CN'):
"""
获取用户基本信息(包括UnionID机制)
详情请参考
https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140839
:param user_id: 普通用户的标识,对当前公众号唯一
:param lang: 返回国家地区语言版本,zh_CN 简体,zh_TW 繁体,en 英语
:return: 返回的 JSON 数据包
使用示例::
... | def get(self, user_id, lang='zh_CN'):
"""
获取用户基本信息(包括UnionID机制)
详情请参考
https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140839
:param user_id: 普通用户的标识,对当前公众号唯一
:param lang: 返回国家地区语言版本,zh_CN 简体,zh_TW 繁体,en 英语
:return: 返回的 JSON 数据包
使用示例::
... | [
"获取用户基本信息(包括UnionID机制)",
"详情请参考",
"https",
":",
"//",
"mp",
".",
"weixin",
".",
"qq",
".",
"com",
"/",
"wiki?t",
"=",
"resource",
"/",
"res_main&id",
"=",
"mp1421140839"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/user.py#L11-L37 | [
"def",
"get",
"(",
"self",
",",
"user_id",
",",
"lang",
"=",
"'zh_CN'",
")",
":",
"assert",
"lang",
"in",
"(",
"'zh_CN'",
",",
"'zh_TW'",
",",
"'en'",
")",
",",
"'lang can only be one of \\\n zh_CN, zh_TW, en language codes'",
"return",
"self",
".",
"... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatUser.get_followers | 获取一页用户列表(当关注用户过多的情况下,这个接口只会返回一部分用户)
详情请参考
https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140840
:param first_user_id: 可选。第一个拉取的 OPENID,不填默认从头开始拉取
:return: 返回的 JSON 数据包
使用示例::
from wechatpy import WeChatClient
client = WeChatClient('appid',... | wechatpy/client/api/user.py | def get_followers(self, first_user_id=None):
"""
获取一页用户列表(当关注用户过多的情况下,这个接口只会返回一部分用户)
详情请参考
https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140840
:param first_user_id: 可选。第一个拉取的 OPENID,不填默认从头开始拉取
:return: 返回的 JSON 数据包
使用示例::
from wechatp... | def get_followers(self, first_user_id=None):
"""
获取一页用户列表(当关注用户过多的情况下,这个接口只会返回一部分用户)
详情请参考
https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140840
:param first_user_id: 可选。第一个拉取的 OPENID,不填默认从头开始拉取
:return: 返回的 JSON 数据包
使用示例::
from wechatp... | [
"获取一页用户列表",
"(",
"当关注用户过多的情况下,这个接口只会返回一部分用户",
")"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/user.py#L39-L63 | [
"def",
"get_followers",
"(",
"self",
",",
"first_user_id",
"=",
"None",
")",
":",
"params",
"=",
"{",
"}",
"if",
"first_user_id",
":",
"params",
"[",
"'next_openid'",
"]",
"=",
"first_user_id",
"return",
"self",
".",
"_get",
"(",
"'user/get'",
",",
"params... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatUser.iter_followers | 获取所有的用户openid列表
详情请参考
https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140840
:return: 返回一个迭代器,可以用for进行循环,得到openid
使用示例::
from wechatpy import WeChatClient
client = WeChatClient('appid', 'secret')
for openid in client.user.iter_followers... | wechatpy/client/api/user.py | def iter_followers(self, first_user_id=None):
"""
获取所有的用户openid列表
详情请参考
https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140840
:return: 返回一个迭代器,可以用for进行循环,得到openid
使用示例::
from wechatpy import WeChatClient
client = WeChatClient('appi... | def iter_followers(self, first_user_id=None):
"""
获取所有的用户openid列表
详情请参考
https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140840
:return: 返回一个迭代器,可以用for进行循环,得到openid
使用示例::
from wechatpy import WeChatClient
client = WeChatClient('appi... | [
"获取所有的用户openid列表"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/user.py#L65-L94 | [
"def",
"iter_followers",
"(",
"self",
",",
"first_user_id",
"=",
"None",
")",
":",
"while",
"True",
":",
"follower_data",
"=",
"self",
".",
"get_followers",
"(",
"first_user_id",
")",
"first_user_id",
"=",
"follower_data",
"[",
"\"next_openid\"",
"]",
"# 微信有个bug... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatUser.get_group_id | 获取用户所在分组 ID
详情请参考
http://mp.weixin.qq.com/wiki/0/56d992c605a97245eb7e617854b169fc.html
:param user_id: 用户 ID
:return: 用户所在分组 ID
使用示例::
from wechatpy import WeChatClient
client = WeChatClient('appid', 'secret')
group_id = client.user.get_gr... | wechatpy/client/api/user.py | def get_group_id(self, user_id):
"""
获取用户所在分组 ID
详情请参考
http://mp.weixin.qq.com/wiki/0/56d992c605a97245eb7e617854b169fc.html
:param user_id: 用户 ID
:return: 用户所在分组 ID
使用示例::
from wechatpy import WeChatClient
client = WeChatClient('appid'... | def get_group_id(self, user_id):
"""
获取用户所在分组 ID
详情请参考
http://mp.weixin.qq.com/wiki/0/56d992c605a97245eb7e617854b169fc.html
:param user_id: 用户 ID
:return: 用户所在分组 ID
使用示例::
from wechatpy import WeChatClient
client = WeChatClient('appid'... | [
"获取用户所在分组",
"ID"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/user.py#L123-L146 | [
"def",
"get_group_id",
"(",
"self",
",",
"user_id",
")",
":",
"res",
"=",
"self",
".",
"_post",
"(",
"'groups/getid'",
",",
"data",
"=",
"{",
"'openid'",
":",
"user_id",
"}",
",",
"result_processor",
"=",
"lambda",
"x",
":",
"x",
"[",
"'groupid'",
"]",... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatUser.get_batch | 批量获取用户基本信息
开发者可通过该接口来批量获取用户基本信息。最多支持一次拉取100条。
详情请参考
https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140839
:param user_list: user_list,支持“使用示例”中两种输入格式
:return: 用户信息的 list
使用示例::
from wechatpy import WeChatClient
client = WeChatClien... | wechatpy/client/api/user.py | def get_batch(self, user_list):
"""
批量获取用户基本信息
开发者可通过该接口来批量获取用户基本信息。最多支持一次拉取100条。
详情请参考
https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140839
:param user_list: user_list,支持“使用示例”中两种输入格式
:return: 用户信息的 list
使用示例::
from wechatpy i... | def get_batch(self, user_list):
"""
批量获取用户基本信息
开发者可通过该接口来批量获取用户基本信息。最多支持一次拉取100条。
详情请参考
https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140839
:param user_list: user_list,支持“使用示例”中两种输入格式
:return: 用户信息的 list
使用示例::
from wechatpy i... | [
"批量获取用户基本信息",
"开发者可通过该接口来批量获取用户基本信息。最多支持一次拉取100条。"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/user.py#L148-L178 | [
"def",
"get_batch",
"(",
"self",
",",
"user_list",
")",
":",
"if",
"all",
"(",
"(",
"isinstance",
"(",
"x",
",",
"six",
".",
"string_types",
")",
"for",
"x",
"in",
"user_list",
")",
")",
":",
"user_list",
"=",
"[",
"{",
"'openid'",
":",
"oid",
"}",... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatUser.change_openid | 微信公众号主体变更迁移用户 openid
详情请参考
http://kf.qq.com/faq/170221aUnmmU170221eUZJNf.html
:param from_appid: 原公众号的 appid
:param openid_list: 需要转换的openid,这些必须是旧账号目前关注的才行,否则会出错;一次最多100个
:return: 转换后的 openid 信息列表 | wechatpy/client/api/user.py | def change_openid(self, from_appid, openid_list):
'''微信公众号主体变更迁移用户 openid
详情请参考
http://kf.qq.com/faq/170221aUnmmU170221eUZJNf.html
:param from_appid: 原公众号的 appid
:param openid_list: 需要转换的openid,这些必须是旧账号目前关注的才行,否则会出错;一次最多100个
:return: 转换后的 openid 信息列表
'''
... | def change_openid(self, from_appid, openid_list):
'''微信公众号主体变更迁移用户 openid
详情请参考
http://kf.qq.com/faq/170221aUnmmU170221eUZJNf.html
:param from_appid: 原公众号的 appid
:param openid_list: 需要转换的openid,这些必须是旧账号目前关注的才行,否则会出错;一次最多100个
:return: 转换后的 openid 信息列表
'''
... | [
"微信公众号主体变更迁移用户",
"openid"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/client/api/user.py#L180-L194 | [
"def",
"change_openid",
"(",
"self",
",",
"from_appid",
",",
"openid_list",
")",
":",
"return",
"self",
".",
"_post",
"(",
"'changeopenid'",
",",
"data",
"=",
"{",
"'from_appid'",
":",
"from_appid",
",",
"'openid_list'",
":",
"openid_list",
"}",
",",
"result... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatMessage.send | 通用的消息发送接口。msg 内需要指定 msgtype 和对应类型消息必须的字段。
如果部分接收人无权限或不存在,发送仍然执行,但会返回无效的部分(即invaliduser或invalidparty或invalidtag),常见的原因是接收人不在应用的可见范围内。
user_ids、party_ids、tag_ids 不能同时为空,后面不再强调。
:param agent_id: 必填,企业应用的id,整型。可在应用的设置页面查看。
:param user_ids: 成员ID列表。
:param party_ids: 部门ID列表。
:... | wechatpy/enterprise/client/api/message.py | def send(self, agent_id, user_ids, party_ids='',
tag_ids='', msg=None):
"""
通用的消息发送接口。msg 内需要指定 msgtype 和对应类型消息必须的字段。
如果部分接收人无权限或不存在,发送仍然执行,但会返回无效的部分(即invaliduser或invalidparty或invalidtag),常见的原因是接收人不在应用的可见范围内。
user_ids、party_ids、tag_ids 不能同时为空,后面不再强调。
:param agent_id... | def send(self, agent_id, user_ids, party_ids='',
tag_ids='', msg=None):
"""
通用的消息发送接口。msg 内需要指定 msgtype 和对应类型消息必须的字段。
如果部分接收人无权限或不存在,发送仍然执行,但会返回无效的部分(即invaliduser或invalidparty或invalidtag),常见的原因是接收人不在应用的可见范围内。
user_ids、party_ids、tag_ids 不能同时为空,后面不再强调。
:param agent_id... | [
"通用的消息发送接口。msg",
"内需要指定",
"msgtype",
"和对应类型消息必须的字段。",
"如果部分接收人无权限或不存在,发送仍然执行,但会返回无效的部分(即invaliduser或invalidparty或invalidtag),常见的原因是接收人不在应用的可见范围内。",
"user_ids、party_ids、tag_ids",
"不能同时为空,后面不再强调。"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/enterprise/client/api/message.py#L28-L58 | [
"def",
"send",
"(",
"self",
",",
"agent_id",
",",
"user_ids",
",",
"party_ids",
"=",
"''",
",",
"tag_ids",
"=",
"''",
",",
"msg",
"=",
"None",
")",
":",
"msg",
"=",
"msg",
"or",
"{",
"}",
"if",
"isinstance",
"(",
"user_ids",
",",
"(",
"tuple",
",... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatMessage.send_text_card | 文本卡片消息
https://work.weixin.qq.com/api/doc#90000/90135/90236/文本卡片消息
请求示例:
{
"touser" : "UserID1|UserID2|UserID3",
"toparty" : "PartyID1 | PartyID2",
"totag" : "TagID1 | TagID2",
"msgtype" : "textcard",
"agentid" : 1,
"textcard" :... | wechatpy/enterprise/client/api/message.py | def send_text_card(self, agent_id, user_ids, title, description, url, btntxt='详情',
party_ids='', tag_ids=''):
""" 文本卡片消息
https://work.weixin.qq.com/api/doc#90000/90135/90236/文本卡片消息
请求示例:
{
"touser" : "UserID1|UserID2|UserID3",
"toparty" : "P... | def send_text_card(self, agent_id, user_ids, title, description, url, btntxt='详情',
party_ids='', tag_ids=''):
""" 文本卡片消息
https://work.weixin.qq.com/api/doc#90000/90135/90236/文本卡片消息
请求示例:
{
"touser" : "UserID1|UserID2|UserID3",
"toparty" : "P... | [
"文本卡片消息"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/enterprise/client/api/message.py#L74-L124 | [
"def",
"send_text_card",
"(",
"self",
",",
"agent_id",
",",
"user_ids",
",",
"title",
",",
"description",
",",
"url",
",",
"btntxt",
"=",
"'详情',",
"",
"party_ids",
"=",
"''",
",",
"tag_ids",
"=",
"''",
")",
":",
"return",
"self",
".",
"send",
"(",
"a... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | WeChatMessage.send_markdown | markdown消息
https://work.weixin.qq.com/api/doc#90000/90135/90236/markdown%E6%B6%88%E6%81%AF
> 目前仅支持markdown语法的子集
> 微工作台(原企业号)不支持展示markdown消息
:param agent_id: 企业应用的id,整型。可在应用的设置页面查看
:type agent_id: string
:param content: markdown内容,最长不超过2048个字节,必须是utf8编码
:type co... | wechatpy/enterprise/client/api/message.py | def send_markdown(self, agent_id, user_ids, content, party_ids='', tag_ids=''):
"""markdown消息
https://work.weixin.qq.com/api/doc#90000/90135/90236/markdown%E6%B6%88%E6%81%AF
> 目前仅支持markdown语法的子集
> 微工作台(原企业号)不支持展示markdown消息
:param agent_id: 企业应用的id,整型。可在应用的设置页面查看
:type ... | def send_markdown(self, agent_id, user_ids, content, party_ids='', tag_ids=''):
"""markdown消息
https://work.weixin.qq.com/api/doc#90000/90135/90236/markdown%E6%B6%88%E6%81%AF
> 目前仅支持markdown语法的子集
> 微工作台(原企业号)不支持展示markdown消息
:param agent_id: 企业应用的id,整型。可在应用的设置页面查看
:type ... | [
"markdown消息"
] | jxtech/wechatpy | python | https://github.com/jxtech/wechatpy/blob/4df0da795618c0895a10f1c2cde9e9d5c0a93aaa/wechatpy/enterprise/client/api/message.py#L243-L275 | [
"def",
"send_markdown",
"(",
"self",
",",
"agent_id",
",",
"user_ids",
",",
"content",
",",
"party_ids",
"=",
"''",
",",
"tag_ids",
"=",
"''",
")",
":",
"msg",
"=",
"{",
"\"msgtype\"",
":",
"\"markdown\"",
",",
"\"markdown\"",
":",
"{",
"\"content\"",
":... | 4df0da795618c0895a10f1c2cde9e9d5c0a93aaa |
train | multivariate_normal | Computes the log-density of a multivariate normal.
:param x : Dx1 or DxN sample(s) for which we want the density
:param mu : Dx1 or DxN mean(s) of the normal distribution
:param L : DxD Cholesky decomposition of the covariance matrix
:return p : (1,) or (N,) vector of log densities for each of the N x... | gpflow/logdensities.py | def multivariate_normal(x, mu, L):
"""
Computes the log-density of a multivariate normal.
:param x : Dx1 or DxN sample(s) for which we want the density
:param mu : Dx1 or DxN mean(s) of the normal distribution
:param L : DxD Cholesky decomposition of the covariance matrix
:return p : (1,) or (... | def multivariate_normal(x, mu, L):
"""
Computes the log-density of a multivariate normal.
:param x : Dx1 or DxN sample(s) for which we want the density
:param mu : Dx1 or DxN mean(s) of the normal distribution
:param L : DxD Cholesky decomposition of the covariance matrix
:return p : (1,) or (... | [
"Computes",
"the",
"log",
"-",
"density",
"of",
"a",
"multivariate",
"normal",
".",
":",
"param",
"x",
":",
"Dx1",
"or",
"DxN",
"sample",
"(",
"s",
")",
"for",
"which",
"we",
"want",
"the",
"density",
":",
"param",
"mu",
":",
"Dx1",
"or",
"DxN",
"m... | GPflow/GPflow | python | https://github.com/GPflow/GPflow/blob/549394f0b1b0696c7b521a065e49bdae6e7acf27/gpflow/logdensities.py#L73-L101 | [
"def",
"multivariate_normal",
"(",
"x",
",",
"mu",
",",
"L",
")",
":",
"mu_ndims",
"=",
"mu",
".",
"shape",
".",
"ndims",
"x_ndims",
"=",
"x",
".",
"shape",
".",
"ndims",
"if",
"x_ndims",
"is",
"not",
"None",
"and",
"x_ndims",
"!=",
"2",
":",
"rais... | 549394f0b1b0696c7b521a065e49bdae6e7acf27 |
train | _TensorFlowOptimizer.make_optimize_tensor | Make Tensorflow optimization tensor.
This method builds optimization tensor and initializes all necessary variables
created by optimizer.
:param model: GPflow model.
:param session: Tensorflow session.
:param var_list: List of variables for training.
:par... | gpflow/training/tensorflow_optimizer.py | def make_optimize_tensor(self, model, session=None, var_list=None, **kwargs):
"""
Make Tensorflow optimization tensor.
This method builds optimization tensor and initializes all necessary variables
created by optimizer.
:param model: GPflow model.
:param session:... | def make_optimize_tensor(self, model, session=None, var_list=None, **kwargs):
"""
Make Tensorflow optimization tensor.
This method builds optimization tensor and initializes all necessary variables
created by optimizer.
:param model: GPflow model.
:param session:... | [
"Make",
"Tensorflow",
"optimization",
"tensor",
".",
"This",
"method",
"builds",
"optimization",
"tensor",
"and",
"initializes",
"all",
"necessary",
"variables",
"created",
"by",
"optimizer",
"."
] | GPflow/GPflow | python | https://github.com/GPflow/GPflow/blob/549394f0b1b0696c7b521a065e49bdae6e7acf27/gpflow/training/tensorflow_optimizer.py#L36-L57 | [
"def",
"make_optimize_tensor",
"(",
"self",
",",
"model",
",",
"session",
"=",
"None",
",",
"var_list",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"session",
"=",
"model",
".",
"enquire_session",
"(",
"session",
")",
"objective",
"=",
"model",
".",
... | 549394f0b1b0696c7b521a065e49bdae6e7acf27 |
train | _TensorFlowOptimizer.make_optimize_action | Build Optimization action task with Tensorflow optimizer.
:param model: GPflow model.
:param session: Tensorflow session.
:param var_list: List of Tensorflow variables to train.
:param feed_dict: Tensorflow feed_dict dictionary.
:param kwargs: Extra parameter... | gpflow/training/tensorflow_optimizer.py | def make_optimize_action(self, model, session=None, var_list=None, **kwargs):
"""
Build Optimization action task with Tensorflow optimizer.
:param model: GPflow model.
:param session: Tensorflow session.
:param var_list: List of Tensorflow variables to train.
... | def make_optimize_action(self, model, session=None, var_list=None, **kwargs):
"""
Build Optimization action task with Tensorflow optimizer.
:param model: GPflow model.
:param session: Tensorflow session.
:param var_list: List of Tensorflow variables to train.
... | [
"Build",
"Optimization",
"action",
"task",
"with",
"Tensorflow",
"optimizer",
"."
] | GPflow/GPflow | python | https://github.com/GPflow/GPflow/blob/549394f0b1b0696c7b521a065e49bdae6e7acf27/gpflow/training/tensorflow_optimizer.py#L59-L82 | [
"def",
"make_optimize_action",
"(",
"self",
",",
"model",
",",
"session",
"=",
"None",
",",
"var_list",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"model",
"is",
"None",
"or",
"not",
"isinstance",
"(",
"model",
",",
"Model",
")",
":",
"rai... | 549394f0b1b0696c7b521a065e49bdae6e7acf27 |
train | _TensorFlowOptimizer.minimize | Minimizes objective function of the model.
:param model: GPflow model with objective tensor.
:param session: Session where optimization will be run.
:param var_list: List of extra variables which should be trained during optimization.
:param feed_dict: Feed dictionary of tensors passed ... | gpflow/training/tensorflow_optimizer.py | def minimize(self, model, session=None, var_list=None, feed_dict=None,
maxiter=1000, initialize=False, anchor=True, step_callback=None, **kwargs):
"""
Minimizes objective function of the model.
:param model: GPflow model with objective tensor.
:param session: Session wh... | def minimize(self, model, session=None, var_list=None, feed_dict=None,
maxiter=1000, initialize=False, anchor=True, step_callback=None, **kwargs):
"""
Minimizes objective function of the model.
:param model: GPflow model with objective tensor.
:param session: Session wh... | [
"Minimizes",
"objective",
"function",
"of",
"the",
"model",
"."
] | GPflow/GPflow | python | https://github.com/GPflow/GPflow/blob/549394f0b1b0696c7b521a065e49bdae6e7acf27/gpflow/training/tensorflow_optimizer.py#L84-L124 | [
"def",
"minimize",
"(",
"self",
",",
"model",
",",
"session",
"=",
"None",
",",
"var_list",
"=",
"None",
",",
"feed_dict",
"=",
"None",
",",
"maxiter",
"=",
"1000",
",",
"initialize",
"=",
"False",
",",
"anchor",
"=",
"True",
",",
"step_callback",
"=",... | 549394f0b1b0696c7b521a065e49bdae6e7acf27 |
train | get_session | Pass session configuration options | gpflow/session_manager.py | def get_session(*args, **kwargs):
"""
Pass session configuration options
"""
if 'config' not in kwargs:
kwargs['config'] = tf.ConfigProto(**settings.session)
if settings.profiling.dump_timeline:
def fill_kwargs(key, value):
"""
Internal function for filling de... | def get_session(*args, **kwargs):
"""
Pass session configuration options
"""
if 'config' not in kwargs:
kwargs['config'] = tf.ConfigProto(**settings.session)
if settings.profiling.dump_timeline:
def fill_kwargs(key, value):
"""
Internal function for filling de... | [
"Pass",
"session",
"configuration",
"options"
] | GPflow/GPflow | python | https://github.com/GPflow/GPflow/blob/549394f0b1b0696c7b521a065e49bdae6e7acf27/gpflow/session_manager.py#L106-L127 | [
"def",
"get_session",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"'config'",
"not",
"in",
"kwargs",
":",
"kwargs",
"[",
"'config'",
"]",
"=",
"tf",
".",
"ConfigProto",
"(",
"*",
"*",
"settings",
".",
"session",
")",
"if",
"settings",
... | 549394f0b1b0696c7b521a065e49bdae6e7acf27 |
train | TracerSession._trace_filename | Creates trace filename. | gpflow/session_manager.py | def _trace_filename(self):
"""
Creates trace filename.
"""
dir_stub = ''
if self.output_directory is not None:
dir_stub = self.output_directory
if self.each_time:
filename = '{0}_{1}.json'.format(
self.output_file_name, self.counter... | def _trace_filename(self):
"""
Creates trace filename.
"""
dir_stub = ''
if self.output_directory is not None:
dir_stub = self.output_directory
if self.each_time:
filename = '{0}_{1}.json'.format(
self.output_file_name, self.counter... | [
"Creates",
"trace",
"filename",
"."
] | GPflow/GPflow | python | https://github.com/GPflow/GPflow/blob/549394f0b1b0696c7b521a065e49bdae6e7acf27/gpflow/session_manager.py#L50-L62 | [
"def",
"_trace_filename",
"(",
"self",
")",
":",
"dir_stub",
"=",
"''",
"if",
"self",
".",
"output_directory",
"is",
"not",
"None",
":",
"dir_stub",
"=",
"self",
".",
"output_directory",
"if",
"self",
".",
"each_time",
":",
"filename",
"=",
"'{0}_{1}.json'",... | 549394f0b1b0696c7b521a065e49bdae6e7acf27 |
train | ScipyOptimizer.make_optimize_tensor | Make SciPy optimization tensor.
The `make_optimize_tensor` method builds optimization tensor and initializes
all necessary variables created by optimizer.
:param model: GPflow model.
:param session: Tensorflow session.
:param var_list: List of variables for training.... | gpflow/training/scipy_optimizer.py | def make_optimize_tensor(self, model, session=None, var_list=None, **kwargs):
"""
Make SciPy optimization tensor.
The `make_optimize_tensor` method builds optimization tensor and initializes
all necessary variables created by optimizer.
:param model: GPflow model.
... | def make_optimize_tensor(self, model, session=None, var_list=None, **kwargs):
"""
Make SciPy optimization tensor.
The `make_optimize_tensor` method builds optimization tensor and initializes
all necessary variables created by optimizer.
:param model: GPflow model.
... | [
"Make",
"SciPy",
"optimization",
"tensor",
".",
"The",
"make_optimize_tensor",
"method",
"builds",
"optimization",
"tensor",
"and",
"initializes",
"all",
"necessary",
"variables",
"created",
"by",
"optimizer",
"."
] | GPflow/GPflow | python | https://github.com/GPflow/GPflow/blob/549394f0b1b0696c7b521a065e49bdae6e7acf27/gpflow/training/scipy_optimizer.py#L27-L52 | [
"def",
"make_optimize_tensor",
"(",
"self",
",",
"model",
",",
"session",
"=",
"None",
",",
"var_list",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"session",
"=",
"model",
".",
"enquire_session",
"(",
"session",
")",
"with",
"session",
".",
"as_defa... | 549394f0b1b0696c7b521a065e49bdae6e7acf27 |
train | ScipyOptimizer.minimize | Minimizes objective function of the model.
:param model: GPflow model with objective tensor.
:param session: Session where optimization will be run.
:param var_list: List of extra variables which should be trained during optimization.
:param feed_dict: Feed dictionary of tensors passed ... | gpflow/training/scipy_optimizer.py | def minimize(self, model, session=None, var_list=None, feed_dict=None, maxiter=1000,
disp=False, initialize=False, anchor=True, step_callback=None, **kwargs):
"""
Minimizes objective function of the model.
:param model: GPflow model with objective tensor.
:param session... | def minimize(self, model, session=None, var_list=None, feed_dict=None, maxiter=1000,
disp=False, initialize=False, anchor=True, step_callback=None, **kwargs):
"""
Minimizes objective function of the model.
:param model: GPflow model with objective tensor.
:param session... | [
"Minimizes",
"objective",
"function",
"of",
"the",
"model",
"."
] | GPflow/GPflow | python | https://github.com/GPflow/GPflow/blob/549394f0b1b0696c7b521a065e49bdae6e7acf27/gpflow/training/scipy_optimizer.py#L54-L91 | [
"def",
"minimize",
"(",
"self",
",",
"model",
",",
"session",
"=",
"None",
",",
"var_list",
"=",
"None",
",",
"feed_dict",
"=",
"None",
",",
"maxiter",
"=",
"1000",
",",
"disp",
"=",
"False",
",",
"initialize",
"=",
"False",
",",
"anchor",
"=",
"True... | 549394f0b1b0696c7b521a065e49bdae6e7acf27 |
train | GPMC.compile | Before calling the standard compile function, check to see if the size
of the data has changed and add parameters appropriately.
This is necessary because the shape of the parameters depends on the
shape of the data. | gpflow/models/gpmc.py | def compile(self, session=None):
"""
Before calling the standard compile function, check to see if the size
of the data has changed and add parameters appropriately.
This is necessary because the shape of the parameters depends on the
shape of the data.
"""
if no... | def compile(self, session=None):
"""
Before calling the standard compile function, check to see if the size
of the data has changed and add parameters appropriately.
This is necessary because the shape of the parameters depends on the
shape of the data.
"""
if no... | [
"Before",
"calling",
"the",
"standard",
"compile",
"function",
"check",
"to",
"see",
"if",
"the",
"size",
"of",
"the",
"data",
"has",
"changed",
"and",
"add",
"parameters",
"appropriately",
"."
] | GPflow/GPflow | python | https://github.com/GPflow/GPflow/blob/549394f0b1b0696c7b521a065e49bdae6e7acf27/gpflow/models/gpmc.py#L57-L70 | [
"def",
"compile",
"(",
"self",
",",
"session",
"=",
"None",
")",
":",
"if",
"not",
"self",
".",
"num_data",
"==",
"self",
".",
"X",
".",
"shape",
"[",
"0",
"]",
":",
"self",
".",
"num_data",
"=",
"self",
".",
"X",
".",
"shape",
"[",
"0",
"]",
... | 549394f0b1b0696c7b521a065e49bdae6e7acf27 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.