腾格里

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实现同步淘宝客订单到本地数据库

评论 23

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
  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) 回复
  5. That is pure token fee seeking your team. yshizi.cn
    http://bit.ly/2Ky51ih

    yshizi.cn (2019-07-05) 回复
  6. Hello. Thx!
    c2231c2074322.com

    Vincentjedia (2019-07-06) 回复
  7. Smooth Parcel has the best rates http://www.smoothparcel.com email helen@smoothparcel.com to get a rate quote for your small parcel deliveries to Europe.
    电子邮件helen@smoothparcel.com获取您的小包裹交付到欧洲的价格报价

    TammyDus (2019-07-08) 回复
  8. 在 https://zolango.com 买卖交易,以比特币收付,可以最简易、最迅速地帮助把产品兑换成国际自由流通比特币。

    Hi,

    I would like to purchase your product please sell it on https://zolango.com where there is a whole niche of customers just waiting to pay in BitCoin.

    https://zolango.com is The Home of CryptoCommerce.

    GregoryRed (2019-07-09) 回复
  9. Look at an major offer as a dose seeking your team. yshizi.cn
    http://bit.ly/2NINEhL

    yshizi.cn (2019-07-15) 回复
  10. There is an fab emolument in behalf of you. yshizi.cn
    http://bit.ly/2NMYfZj

    yshizi.cn (2019-07-19) 回复
  11. Provides payday loans up to $1,000, which customers can gain the next responsibility day. usaloansreviews
    They also offer brokered installment loans up to $2,400, a savings program and access to unconstrained monetary tools.

    Wilsonhon (2019-07-19) 回复
  12. Ciao! yshizi.cn

    We suggesting

    Sending your commercial offer through the Contact us form which can be found on the sites in the contact partition. Feedback forms are filled in by our program and the captcha is solved. The superiority of this method is that messages sent through feedback forms are whitelisted. This technique improve the probability that your message will be open.

    Our database contains more than 25 million sites around the world to which we can send your message.

    The cost of one million messages 49 USD

    FREE TEST mailing of 50,000 messages to any country of your choice.

    This message is automatically generated to use our contacts for communication.

    Contact us.
    Telegram - @FeedbackFormEU
    Skype FeedbackForm2019
    WhatsApp - +44 7598 509161
    Email - FeedbackForm@make-success.com

    ContactForm (2019-07-22) 回复
  13. This is Robert Kowalski from LegalPL Company from Poland-Warsaw (Europe).
    In this mail sending you special our offer about immigration services to Europe:
    1. Work 1 Year Visa to Poland (Work Visa+Work Permit);
    2. Study in Poland (Study 1 Year Visa);
    3. Business Immigration to Poland (Business 1 Year Visa);
    Mostly our clients from India, Pakistan, Nepal, Bangladesh, Vietnam, China, Iran, Ukraine, Russia, Belarus, Philippines, Indonesia, Vietnam, China.
    If you are interesting in our services, please contact with us in WhatsUp/Viber/Telegram +48 793 636 986 or write me: r.kowalski@legalpl.net
    Thank you,
    Best Regards,
    Robert Kowalski,
    LegalPL Company

    Joshuadwema (2019-07-23) 回复
  14. Look at a okay offers in behalf of you. yshizi.cn
    http://bit.ly/2NGSGLF

    yshizi.cn (2019-07-26) 回复
  15. Ciao! yshizi.cn

    We propose

    Sending your message through the feedback form which can be found on the sites in the Communication partition. Feedback forms are filled in by our application and the captcha is solved. The superiority of this method is that messages sent through feedback forms are whitelisted. This technique raise the odds that your message will be open.

    Our database contains more than 25 million sites around the world to which we can send your message.

    The cost of one million messages 49 USD

    FREE TEST mailing of 50,000 messages to any country of your choice.

    This message is automatically generated to use our contacts for communication.

    Contact us.
    Telegram - @FeedbackFormEU
    Skype FeedbackForm2019
    Email - FeedbackForm@make-success.com
    WhatsApp - +44 7598 509161

    DavidRef (2019-08-01) 回复
  16. My name is Mr. Steven Albert, I'm a foreign investment management consultant , am representing the interest of Mr. A. S AlSayed and partners www.alsayedgroup.com who is ready to invest in any profitable business with good ROI .

    I will be glad to hear from you on any potential opportunity for further discussion.

    Call me on +1 (701) 4842612 or email me on : info@alliedinvestmentservices.org

    Yours Sincerely,

    Mr. Steven Albert.
    Investment Manager.

    HarrisRourb (2019-08-08) 回复
  17. Look at an demanding betterment in devote up since of victory. http://sioculejaz.tk/7nkx

    http://soundprobapun.tk/nuaf (2019-08-10) 回复
  18. We buy all crypto currencies at good rate, with reasonable commission between sellers and the mandates.

    Contact us with the informations below if you are or have a potential seller.

    Tel: +353 1 4378345
    Fax: +353 1 6865354
    Email: edwardm@lioncourtcrypto.com

    Thank you,
    Crypto currencies Purchase Department,
    Edward Molina.

    JosephWrola (2019-08-10) 回复
  19. As a business you may be using some or other email system - time to upgrade to Google's Business Email System - G Suite. G Suite contains apps like business emails, drive, docs and video/audio conferencing and much more.
    Review more here: https://protostarcs.com/g-suite
    Or reach us at Email: need@proerp.cloud
    or Skype: need@proerp.cloud
    or WhatsApp: +91 9359453615
    see more details about G Suite: https://gsuite.google.co.in/

    Herbertarilm (2019-08-14) 回复
  20. Advance Service USA is an online marketplace that connects those looking for the treatment of payday loans with a network of lenders.
    www.loansreviewsusa.com

    Kennyhon (2019-08-15) 回复
  21. We suffer with compiled a cant of the best payday accommodation lenders http://www.uspaydayloansreviews.com/ for those times when a true danger hits, and your inadequate tribute prevents you from captivating an emergency lend from elsewhere. To station these payday lenders we scored them on how abrupt the loan was deposited into an account, and how much talk into was added. We have also provided a oversee on how to keep away from the less upstanding lenders and also payday advance alternatives in regard to you to consider.

    Johnnyhon (2019-08-16) 回复
  22. Looking recompense the superior auto guarantee reviews? Our indemnity experts http://www.insurancereviewsusa.com/ comprise researched 21+ car guaranty companies and compared them with their competition.

    Konorhon (2019-08-17) 回复
  23. If you’ve skim fertility of guaranty company reviews insuranceforusa.org and peaceful can’t settle on, it capacity refrain from to fall various quotes to compare. Depending on where you remain and other factors, joined friends could put up for sale a much heartier deal on auto surety than the rest.

    Mickeyhon (2019-08-20) 回复