get_book_content.py 595 字节
Newer Older
ToTensor's avatar
ToTensor 已提交
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
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 {}