Explorar o código

添加支付密码配置

HuangYiwei %!s(int64=5) %!d(string=hai) anos
pai
achega
06294f3db2
Modificáronse 2 ficheiros con 10 adicións e 1 borrados
  1. 8 0
      config.ini
  2. 2 1
      jd_spider_requests.py

+ 8 - 0
config.ini

@@ -16,6 +16,14 @@ DEFAULT_USER_AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKi
 # 是否使用随机 useragent,默认为 false
 random_useragent = false
 
+[account]
+# 支付密码
+# 如果你的账户中有可用的京券(注意不是东券)或 在上次购买订单中使用了京豆,
+# 那么京东可能会在下单时自动选择京券支付 或 自动勾选京豆支付。
+# 此时下单会要求输入六位数字的支付密码。请在下方配置你的支付密码,如 123456 。
+# 如果没有上述情况,下方请留空。
+payment_pwd = ""
+
 [messenger]
 # 使用了Server酱的推送服务
 # 如果想开启下单成功后消息推送,则将 enable 设置为 true,默认为 false 不开启推送

+ 2 - 1
jd_spider_requests.py

@@ -549,7 +549,7 @@ class JdSeckill(object):
             'invoicePhone': invoice_info.get('invoicePhone', ''),
             'invoicePhoneKey': invoice_info.get('invoicePhoneKey', ''),
             'invoice': 'true' if invoice_info else 'false',
-            'password': '',
+            'password': global_config.get('account', 'payment_pwd'),
             'codTimeType': 3,
             'paymentType': 4,
             'areaCode': '',
@@ -560,6 +560,7 @@ class JdSeckill(object):
             'token': token,
             'pru': ''
         }
+
         return data
 
     def submit_seckill_order(self):