Skip to content

Commit

Permalink
Update and rename JD_login.py to jd_assistant.py
Browse files Browse the repository at this point in the history
  • Loading branch information
tychxn authored Jul 10, 2018
1 parent 6002d27 commit 8f9809b
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions JD_login.py → jd_assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
import pickle
from bs4 import BeautifulSoup

from JD_tools import *
from jd_tools import *


class JDlogin(object):
class Assistant(object):

def __init__(self):
self.username = ''
Expand Down Expand Up @@ -75,7 +75,7 @@ def _need_auth_code(self, username):
return js['verifycode']

def _get_auth_code(self, uuid):
image_file = os.path.join(os.getcwd(), 'JD_authcode.jpg')
image_file = os.path.join(os.getcwd(), 'jd_authcode.jpg')

url = 'https://authcode.jd.com/verify/image'
payload = {
Expand Down Expand Up @@ -540,15 +540,16 @@ def get_order_info(self, unpaid=True):


if __name__ == '__main__':
jd = JDlogin()
jd.login_by_username()
# jd.login_by_QRcode()
print(jd.get_item_stock_state(sku_id='5089267', area='12_904_3375'))
print(jd.get_item_price(sku_id='5089267'))
jd.clear_cart()
jd.add_item_to_cart(sku_id='5089267')
jd.get_cart_detail()
jd.get_checkout_page_detail()
jd.get_user_info()
jd.submit_order()
jd.get_order_info(unpaid=True)
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()
asst.get_user_info()
asst.submit_order()
asst.get_order_info(unpaid=True)

0 comments on commit 8f9809b

Please sign in to comment.