Common third-party packages, sdk library interface

Common third-party packages, sdk library interface

a Alipay: https://openhome.alipay.com/developmentDocument.htm
1. generate and configure key to save the public and businesses Ali private key to the project, to save the business public Alipay open platform
2. install the third-party payment sdk, first remove pycrypto, then alipay-sdk-install Python
3. call the third-party payment interface functions, refer to the developer documentation
4.AliPay class encryption algorithm parameter selection and fill in the sandbox id RSA2 examples generation alipay
5. call instance method api_apipay_trade_page_pay, parameter name, order number, and the amount (must str)
6.5 returned pay_url mosaic sandbox url prefix https://openapi.alipaydev.com/gateway.do? returned to the browser

two , micro-channel public number:  https://mp.weixin.qq.com/wiki/home/index.html
1. server configuration settings, URL (containing our public network ip), token (any string), message encryption key (automatically generated)
2. submit the test page number management will send the request to get the url, we need to get written request is received view, exchange and micro-channel server
3. verify that the micro-channel server address valid Receiving four parameters, check signature, confirming good return echostr

three, seven cattle cloud: https://developer.qiniu.com/sdk#official-sdk
1. The seven cattle cloud services purchased for the project, get three parameters access_key, SECRET_KEY, BUCKET_NAME
2. installation qiniu, and then import qiniu
3. upload pictures packaging method, Auth get seven cattle cloud object, call upload_token Get upload token, then realized put_data upload, return ret, info, upload pictures successfully if info.status_code == 200, to obtain a unique identification in accordance with ret.get ( 'Key') Key
4. seven cattle cloud domain stitching url link to get the full picture display.

Fourth, the cloud communications: http://doc.yuntongxun.com/p/5a533e0c3b8496dd00dce08c
1. Download the cloud communications platform SDK and the purchase of services, access to accountSid, accountToken, appId, serverIP, serverPort, softVersion
2. SDK integrated into the project, achieve rest = REST (serverIP, serverPort, softVersion), rest.setAccount (accountSid, accountToken); rest.setAppId (appId) initialization
3. Complete the test number, integration testing in the cloud communications, send a test message,
4.sendTemplateSMS (phone number , [ 'code', 'time expired'], 'template id (default 1)') to send SMS
5.4 returns the value in acquiring get ( 'statusCode') if the return '000000', then send text messages success, or failure.

V. Green Unicorn (gunicorn):
1.
2. daemon open: gunicorn number -w process -D -b IP: PORT --access-logfile ./logs/log manage: app

VI, Ali cloud (cloud server the ESC)
1. Log in to the cloud server: ssh user name @IP address, enter the password
2. install the virtual environment into the virtual environment and install Flask and other packages
3. install the back-office services: ① software update apt source sudo apt-get update ② and install mysql-GET install nginx, etc. XX apt
4. uwisg cloud server deployment: install uwsgi, uwsgi.ini added to the project, the project by scp to upload to the cloud server
scp -r ~ / local path root @ Ali cloud ip: / Ali cloud path
5. cloud server deployment nginx: ① modified uwsgi .ini the socket options open; ② configured nginx server
③ start ngnix server: /etc/init.d/nginx start 
④ uwsgi restart the server: uwsgi --stop uwsgi.pid; uwsgi --ini uwsgi.ini

seven, celery (task queue)
1. enter the virtual environment, install == 4.1.0 celery
2. create a task celery asynchronous file task.py
3. create a selery client object app = Celery ( 'cerery_tasks.tasks', broker =' redis: //127.0 .0.1: 6379/1 ')
parameter 1 asynchronous file, Redis intermediary parameter 2 (start needed)
4 is added to the function for an asynchronous decorator @ app.task
5. Copy the item elsewhere, as celery server, adding the following code tasks.py the server simply add :()
Import Import Django os.environ.setdefault OS ( "the DJANGO_SETTINGS_MODULE", "dailyfresh.settings") # Set environment variable django.setup () # initialize django environment 
6. enter the server project, start the server celery celery -A celery_tasks.tasks worker -l info (in a virtual environment) 7. calling the function, the call to delay () asynchronous operation   

More technical information may concern: gzitcast

Guess you like

Origin www.cnblogs.com/heimaguangzhou/p/11590759.html