Techcombine电子商务框架

techcombine的Python项目详细描述


techcombine框架

为所有人安装

$pip install techcombine

开发者安装

^{pr2}$

现在您可以使用pytestpytest 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)

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
带有字符串的java JNA调用与带有字节[]的java JNA调用的行为不同   java基于键列表获取子映射   重启后永久增加java堆大小?   JavaHTTPS服务器:相互SSL身份验证   java为什么接受接口的方法会拒绝该接口的实现?   片段中的java视图无法应用于()   ms access Java SQL更新命令不工作   java将web服务自动打包和部署到Oracle Application Server 10g   java有没有办法在安卓 studio中为安卓时钟设置多个警报?   位于FTP服务器上的文件上的Java校验和md5   在Java中创建类时遇到问题。有些方法不太确定   java错误:在类chrome\u驱动程序中找不到主方法   通用海图(Javascript\Java)