Techcombine电子商务框架
techcombine的Python项目详细描述
techcombine框架
为所有人安装
$pip install techcombine
开发者安装
^{pr2}$现在您可以使用pytest
或pytest direstory/
来测试这个包
$pytest# or$pytest .\techcombine\tests\
来源安装
(env)$python setup.py install
手册
类LINENotify
方法:notify_hook(subtitle,api,token,data=None,**kwargs)从服务器使webhook到Line notify 返回:请求
fromtechcombine.utilsimportgenerate_notify_dataLINENotify.notify_hook(subtitle,data=None:dict,**kwargs)# When you use this method you need to defind variable in django.conf settingsLINE_NOTIFY_TOKEN=somesting+'access_token'LINE_NOTIFY_API='https://notify-api.line.me/api/notify'# Data exampledata={"Order ID":order.slug,"email":order.email,"first_name":order.first_name,"phone_number":order.phone_number,"created_at":order.created_at,}# Or use generate_notify_data(ojb)
参数:
- subtitle:(str)是数据挂线通知聊天的子标题
- data:(默认值=None/DictType only)是要在邮件中显示的所有数据的dict
- 或使用**dict
方法:generate_notify_data(obj,key_type=“id”,header=None)从django models对象生成dict数据。 return:notify_hook()中使用的dict数据格式
fromtechcombine.utilsimportgenerate_notify_datadata=generate_notify_data(ojb,key_type="id",header=None)
参数:
- obj:(Django models object)字段['对象id或者目标鼻涕虫','name','email','created\u at','url']
#if header=None: data will doesn't have url field
- key_type:(str)ID或Slug中的对象键的类型
- 用于填充对象链接url的头:(str)
类邮件服务
方法:send_email(from_email,to_emails,subject,html_content,token)通过sendgrid将电子邮件从发送到发送到电子邮件 退货请求响应
fromtechcobine.mailimportMailServiceimportosfrom_email='from_email@example.com',to_emails='to@example.com',subject='For example subject',html_content='<strong>and easy to do anywhere, even with Python</strong>'token=os.environ.get('SENDGRID_API_KEY')MailService.send_email(from_email,to_emails,subject,html_content,token)
参数:
- from_email:type(string)是电子邮件发件人。在
- to\u email:type(string),是电子邮件收件人。在
- subject:type(string)是此电子邮件的主题。在
- html_content:type(字符串),在电子邮件中为呈现模板编写html。在
- token:type(string),是sendgrid api令牌。在
方法:send_verify_email(from_email,to_email,host_name,user_token,sendgrid_token,subject=None)sendgrid将verify email from_email to to to_email by sendgrid return:请求响应
MailService.send_verify_email(from_email,to_email,host_name,user_tokenmsendrid_token)
方法:send_reset_password(from_email,to_email,host_name,user_token,sendgrid_token,subject=None)发送重置密码 return:请求响应
Mail.Service.send_reset_password(from_email,to_email,host_name,user_tokenmsendrid_token)
- 项目
标签: