腾格里

python实现同步淘宝客订单到本地数据库

阿里不对小淘客开放淘客订单查询功能,所以只能通过程序登录联盟账号爬取订单信息。网上找了一个别人python写的,我增加了一段同步mysql数据库代码。第一次写python,遇到了很多坑,不过python确实很简单,代码很精简。

所需环境

python3
requests
selenium
pymysql

运行

python alimama.py

因为需要chrome浏览器登录,所以好需要下载对应的浏览器驱动。
chrome各版本对应驱动 参考 https://blog.csdn.net/morling05/article/details/81094151

用到的数据库表结构

DROP TABLE IF EXISTS tb_order

CREATE TABLE tb_order (
id int(11) NOT NULL AUTO_INCREMENT,
orderNo varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
openid varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
payment decimal(10,2) DEFAULT NULL,
cashouttotal decimal(10,2) DEFAULT NULL,
status varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
channel varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
createdatetime datetime DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

代码下载:update-alimama-order.zip

未经允许不得转载:腾格里 » python实现同步淘宝客订单到本地数据库

评论 4

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
  1. 评论的UI证件写

    哎哎哎 (2019-06-14) 回复
  2. what?

    admin (2019-06-16) 回复
  3. EVROSIS Technologies’s turnkey solutions: we customize our products and services to meet the exact requirements of our clients. At EVROSIS TECHNOLOGIES, our developers, engineers, and data scientists are experts in Financial Engineering, High Frequency Trading, Trading Platform & financial markets.

    Our competitive strengths: High Speed Networks Development, High Performance Computing, Deep Learning A.I., High Sharpe Ratio Trading models, and talented Quant Traders.

    You can Get custom Trading Solutions for any Exchanges/ECNs in The World or use pre-prepared Solutions and Profit from a state-of-the-Art Model. You will save Time and Money by Working with Us.

    Contact us and we will implement your needs.

    Kind regards

    Website : http://bit.ly/2ZwzhOP
    Skype: support.evrosis
    E-mail : info@evrosis.com
    EVROSIS Technologies Ltd.
    130 Old Street, London, United Kingdom, EC1V 9BD

    Jeromespoig (2019-06-24) 回复
  4. Are you an individual businessman or a business organization that wants to expand in business but has problem with funding?
    Intermediaries/Consultants/Brokers are welcome to bring their clients and are 100% protected. In complete confidence, we will work together for the benefits of all parties involved.
    Contact us on this email: razulizabiti@consultant.com
    Regards,
    Razul Izabiti

    OuidaInfiz (2019-06-25) 回复