Пример #1
0
#!/usr/bin/env python
# -*- coding:utf-8 -*-
from jd_assistant import Assistant

if __name__ == '__main__':
    asst = Assistant()
    asst.login_by_QRcode()  # 扫码登陆
    asst.clear_cart()  # 清空购物车
    asst.add_item_to_cart(sku_id='1626336666')  # 添加到购物车

    # 3种订单提交方式:
    # 1.直接提交订单
    # asst.submit_order()
    # 2.有货时提交订单
    asst.submit_order_by_stock(sku_id='1626336666',
                               area='1_2802_2821')  # 监控的商品id和地址id
    # 3.定时提交订单
    # asst.submit_order_by_time(buy_time='2018-10-19 00:00:00.500', retry=3, interval=5)

    asst.get_order_info(unpaid=False)  # 查询未付款订单
    """
    输出实例:
    [2018-10-19 02:38:58] 登录成功
    [2018-10-19 02:38:58] 购物车清空成功
    [2018-10-19 02:38:58] 1626336666已成功加入购物车
    [2018-10-19 02:38:59] 1626336666有货了,正在提交订单……
    [2018-10-19 02:38:59] 订单提交成功! 订单号:811545xxxxx
    ************************订单列表页查询************************
    订单号:811545xxxxx----下单时间:2018-10-19 02:38:59----商品列表:1626336666 x 1----订单状态:等待付款----总金额:89.90元----付款方式:在线支付
    """
Пример #2
0
#!/usr/bin/env python
# -*- coding:utf-8 -*-
from jd_assistant import Assistant

if __name__ == '__main__':
    asst = Assistant()
    asst.login_by_username()
    # asst.login_by_QRcode()
    print(asst.get_item_stock_state(sku_id='5089267', area='12_904_3375'))
    print(asst.get_item_price(sku_id='5089267'))
    asst.clear_cart()
    asst.add_item_to_cart(sku_id='5089267')
    asst.get_cart_detail()
    asst.get_checkout_page_detail()
    print(asst.get_user_info())
    # asst.submit_order()
    asst.get_order_info(unpaid=False)
Пример #3
0
    https://github.com/tychxn/jd-assistant/wiki/1.-%E4%BA%AC%E4%B8%9C%E6%8A%A2%E8%B4%AD%E5%8A%A9%E6%89%8B%E7%94%A8%E6%B3%95
    """
    # sku_ids 商品id
    # sku_ids = '100011521400'  # 振德 (ZHENDE) 口罩一次性医用口罩 预约21点 抢购10点 数量3000
    # sku_ids = '100011551632'  # 3Q医用口罩  预约15点 抢购20点 数量10000
    # sku_ids = '65708238590'  # 袋鼠医生  预约15点 抢购20点 数量??

    sku_ids = '100011551632'
    area = '12_904_905_50601'  # 区域id
    buy_time = '2020-02-16 01:17:59.500'  # 下单时间

    asst = Assistant()  # 初始化
    asst.login_by_QRcode()  # 扫码登陆

    # 1.根据商品id添加购物车,下单
    asst.add_item_to_cart(sku_ids=sku_ids)
    # 提交订单
    asst.submit_order()

    # 2.清空购物车,下单
    # asst.clear_cart()
    # asst.submit_order() # 提交订单

    # 4.定时提交订单示例(常用)
    # asst.submit_order_by_time(buy_time=buy_time, retry=4, interval=5)  # 定时提交订单
    # 3个参数:
    # buy_time: 下单时间,例如:'2019-02-16 01:17:59.500'
    # retry: 下单重复执行次数,可选参数,默认4次
    # interval: 下单执行间隔,可选参数,默认5秒

    # 5.根据商品是否有货自动下单
Пример #4
0
        # 开始抢购
        if buy_time:
            rand_msecond = random.randint(1, 9) * 1000
            buy_time = buy_time + '.000'
            # buy_time = buy_time + "." + str(rand_msecond)
        else:
            print('获取抢购时间失败')
            buy_time = input("请输入抢购时间(2020-03-04 00:59:59.000):")
        asst.exec_reserve_seckill_by_time(sku_id=sku_id,
                                          buy_time=buy_time,
                                          retry=10,
                                          interval=1,
                                          num=1)
        # asst.exec_seckill_by_time(sku_ids=sku_id, buy_time=buy_time, retry=15, interval=0.2, num=1)
    elif model_type == '2':
        print("正常有货购买...")
        sku_ids = input("请输入一个或多个sku_id:")
        area = input("请输入area_id:")
        asst.buy_item_in_stock(sku_ids=sku_ids,
                               area=area,
                               wait_all=False,
                               stock_interval=5)
    elif model_type == '3':
        print("正常定时购买...")
        sku_ids = input("请输入一个或多个sku_id:")
        buy_time = input("请输入定时购买时间(2020-03-04 00:59:59.000):")
        asst.clear_cart()  # 清空购物车(可选)
        asst.add_item_to_cart(sku_ids=sku_ids)  # 根据商品id添加购物车(可选)
        asst.submit_order_by_time(buy_time=buy_time, retry=10,
                                  interval=5)  # 定时提交订单
Пример #5
0
#!/usr/bin/env python
# -*- coding:utf-8 -*-
from jd_assistant import Assistant

if __name__ == '__main__':
    asst = Assistant()  # 初始化
    asst.login_by_QRcode()  # 扫码登陆
    asst.clear_cart()  # 清空购物车(可选)
    asst.add_item_to_cart(sku_ids='100011293950')  # 根据商品id添加购物车(可选)
    asst.submit_order_by_stock(sku_ids='100011293950',
                               area='27_2376_50230_53680')  # 监控的商品id和地址id
    # 3个参数:
    # sku_ids: 商品id
    # area: 地区id
    # interval: 查询库存间隔,可选参数,默认为3秒/次