File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import time
2+
3+ import requests
4+
5+ GOODS_API_BASE = 'https://goods-server.test.dp.tech'
6+ FINANCE_API_BASE = 'https://finance-web.test.dp.tech'
7+ user_id = 110680
8+ sku_id = 10808
9+
10+
11+ def sku_list ():
12+ url = f"{ GOODS_API_BASE } /api/v1/sku/list"
13+ payload = {'skuIds' : [sku_id ]}
14+ response = requests .post (
15+ url , json = payload , headers = {'Content-Type' : 'application/json' }
16+ )
17+ response .raise_for_status ()
18+ data = response .json ()
19+
20+ print (data )
21+
22+
23+ def info ():
24+ url = f"{ FINANCE_API_BASE } /api/integral/info"
25+ payload = {'userId' : int (user_id )}
26+
27+ response = requests .post (
28+ url , json = payload , headers = {'Content-Type' : 'application/json' }
29+ )
30+ response .raise_for_status ()
31+ data = response .json ()
32+ print (data )
33+
34+
35+ def consume ():
36+ url = f"{ FINANCE_API_BASE } /api/integral/consume"
37+ payload = {
38+ 'userId' : int (user_id ),
39+ 'bizNo' : int (time .time ()),
40+ 'changeType' : 2 ,
41+ 'eventValue' : int (1 ),
42+ 'skuId' : int (sku_id ),
43+ }
44+ response = requests .post (
45+ url , json = payload , headers = {'Content-Type' : 'application/json' }
46+ )
47+ response .raise_for_status ()
48+ data = response .json ()
49+ print (data )
50+
51+
52+ if __name__ == '__main__' :
53+ info ()
You can’t perform that action at this time.
0 commit comments