You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.3 KiB
46 lines
1.3 KiB
from urllib.parse import urljoin |
|
from lib.http_req import req |
|
from config import global_data |
|
|
|
SUB_URL = '?m=web&a=getSeatPlans' |
|
|
|
|
|
class GetSeatPlans: |
|
def __init__(self, data): |
|
self.api_name = 'get_seat_plans' |
|
self.url = urljoin(data['basic_data']['url_http'], SUB_URL) |
|
self.user_name = data['basic_data']['user_name'] # 固定写死的参数 |
|
self.password = data['basic_data']['password'] # 固定写死的参数 |
|
self.cinema_id = data['basic_data']['cinema_id'] |
|
self.req_method = data['http_req_method'] # http接口请求方法POST或GET |
|
self.get_show_rule = data['rules']['get_shows'] |
|
|
|
def prepare(self): |
|
pass |
|
|
|
def request(self, hall_id): |
|
# 准备请求数据 |
|
self.prepare() |
|
|
|
params = { |
|
'user': self.user_name, # 授权用户名 |
|
'pass': self.password, # 授权密码 |
|
'cinema': self.cinema_id, # 影院三位编码 |
|
} |
|
data = { |
|
'hallId': hall_id, # 影厅Id |
|
} |
|
resp_params, resp_data, response = req(self.api_name, self.url, self.req_method, params, data) |
|
|
|
# 处理返回的数据 |
|
self.handle() |
|
|
|
return resp_params, resp_data, response |
|
|
|
def handle(self): |
|
pass |
|
|
|
|
|
if __name__ == "__main__": |
|
api = GetSeatPlans(global_data) |
|
api.request(hall_id='7')
|
|
|