Techcombine framework for ecommerce
Project description
techcombine-framework
Installation for everyone
$pip install techcombine
Installation for Developer
$pip install techcombine[dev]
Now you can test this package by using pytest
or pytest direstory/
, For example
$pytest
# or
$pytest .\techcombine\tests\
Installation from sources
(env)$python setup.py install
manual
class LINENotify
Method: notify_hook(subtitle, api, token, data=None, **kwargs) Make webhook to Line Notify from your server
return: request
from techcombine.utils import generate_notify_data
LINENotify.notify_hook(subtitle, data=None: dict, **kwargs)
# When you use this method you need to defind variable in django.conf settings
LINE_NOTIFY_TOKEN = some sting + 'access_token'
LINE_NOTIFY_API = 'https://notify-api.line.me/api/notify'
# Data example
data = {
"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)
parameter:
- subtitle: (str) Is subtitle of data hook to line notify chat
- data: (default=None/DictType only) Is dict of your all data to show in mail
- Or using **dict
Method: generate_notify_data(obj, key_type="id", header=None) Generate dict data from django models object. return: dict data format for using in notify_hook()
from techcombine.utils import generate_notify_data
data = generate_notify_data(ojb, key_type="id", header=None)
parameter:
- obj: (Django models object) field['obj.id or obj.slug', 'name', 'email', 'created_at', 'url']
#if header=None: data will doesn't have url field
- key_type: (str) Type of object key from ID or Slug
- header: (str) For fill link url of object
Class MailService
Method: send_email(from_email, to_emails, subject, html_content, token) Send email from from_email to to_email by sendgrid
return request response
from techcobine.mail import MailService
import os
from_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)
parameter:
- from_email: type(string), Is an email sender.
- to_email: type(string), Is an email recipients.
- subject: type(string), Is subject of this email.
- html_content: type(string), write html for render template on email.
- token: type(string), Is sendgrid api token.
Method: send_verify_email(from_email, to_email, host_name, user_token, sendgrid_token, subject=None) Send verify email from from_email to to_email by sendgrid
return: request response
MailService.send_verify_email(from_email, to_email, host_name, user_tokenm sendrid_token)
Method: send_reset_password(from_email, to_email, host_name, user_token, sendgrid_token, subject=None) Send to reset password
return: request response
Mail.Service.send_reset_password(from_email, to_email, host_name, user_tokenm sendrid_token)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file techcombine-0.0.3.tar.gz
.
File metadata
- Download URL: techcombine-0.0.3.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e456c11961fc77077bd139af9d8c2601f6fe7eeadfdb8487cad358a3e675f43 |
|
MD5 | 5d622a84fe56034f9855cd235c73b41d |
|
BLAKE2b-256 | 5d337e711b4859084e3ac3963e5854726f3fe59fb5b293f61fba2bc7130b8e38 |