import json import requests import logging logger = logging.getLogger(__name__) def get_chapter_content(params): url = 'http://192.168.50.117:9003/v1/chapter/content' headers = { "Cookie":"UserToken=149ba8a7a8d341bbbe41f904c4c9b176;UserName=xiuxiuyayayy" } result = requests.get(url=url, params=params, headers=headers) if result.status_code == 200: ret = json.loads(result.text) logger.info('request success') content = ret['data'] return content else: logger.info('request failed!!!!!') return {} def get_chapter_list(params): url = 'http://192.168.50.117:9003/inner/v1/chapter/list' headers = { "Cookie":"UserToken=149ba8a7a8d341bbbe41f904c4c9b176;UserName=xiuxiuyayayy" } result = requests.get(url=url, params=params, headers=headers) if result.status_code == 200: ret = json.loads(result.text) logger.info('request success') content = ret['data'] return content else: logger.info('request failed!!!!!') return {}