-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCartOperation.py
45 lines (40 loc) · 1.36 KB
/
CartOperation.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import requests
import random
class CartOperation():
def __init__(self, thor):
self.thor = thor
#购物车全选
def selectAll(self):
response = requests.post('https://cart.jd.com/selectAllItem.action', headers={
'Referer': 'https://cart.jd.com/cart.action'
}, cookies={
'thor': self.thor
}, data={
# 'locationId':'17-1381-50713-52576',
# 'outSkus':None,
# 't':0,
# 'random':0.93
})
#购物车全取消
def cancelAll(self):
response = requests.post('https://cart.jd.com/cancelAllItem.action',headers={
'Referer': 'https://cart.jd.com/cart.action'
},cookies={
'thor': self.thor
})
#选中单个商品
def selectItem(self,pid,targetId,ptype):
response = requests.post('https://cart.jd.com/selectItem.action?rd'+str(random.random()),headers={
'Referer': 'https://cart.jd.com/cart.action'
},cookies={
'thor': self.thor
},data={
# 'packId' : 0,
'pid' : '3488558', #商品号
'promoID' : '50000061698', #不知道是啥,但必须带着
'ptype' : 11, #同上
'targetId' : '50000061698' #同上
# 't' : 0,
# 'targetId' : 0,
# 'venderId' : 8888
})