def get_purchased_structure() -> list:
    url = "https://entree.igetget.com/purchased/v1/index/structure"
    post_data = {}
    response_text = request_util.post(url, post_data,
                                      igetget_config.CONTENT_TYPE_FORM)
    lst = request_util.get_data_list(response_text)
    lsieun_util.view(lst)
    return lst
def get_group_data(group_type: int, order_name: str) -> list:
    # (1)請求的url和data
    url = "https://entree.igetget.com/purchased/v1/index/groupdata"
    post_data = {"group_type": group_type, "order_name": order_name}

    response_text = request_util.post(url, post_data,
                                      igetget_config.CONTENT_TYPE_FORM)
    lst = request_util.get_data_list(response_text)
    lsieun_util.view(lst)
    return lst
Beispiel #3
0
def get_info(response_text):
    # resp_dict = json.loads(response_text)
    # content_dict = resp_dict.get("c")
    # article_list = content_dict.get("list")
    article_list = request_util.get_data_list(response_text)
    if not article_list:
        return False, None

    num = len(article_list)
    cur_article = article_list[num-1]
    publish_time_stamp = cur_article.get("publish_time_stamp")
    return True, publish_time_stamp
Beispiel #4
0
def get_course_category(group_type=40):
    template = igetget_config.IGETGET_CATEGORY_PATH
    file_path = template.format(group_type)

    category_list = []
    line_list = lsieun_util.read_line_list(file_path)
    for line in line_list:
        lst = request_util.get_data_list(line)
        category_list += lst

    cat_list = []
    for category in category_list:
        cat = simplify_course_category(category)
        cat_list.append(cat)

    lsieun_util.view(cat_list)

    return cat_list
Beispiel #5
0
def save_category_list(group_type):
    url = "https://entree.igetget.com/purchased/v1/category/lists"

    category_list = []
    page = 1
    while True:
        post_data = {
            "group_type": group_type,
            "order_name": "open",
            "page": page
        }

        response_text = request_util.post(url, post_data,
                                          igetget_config.CONTENT_TYPE_FORM)
        lst = request_util.get_data_list(response_text)
        if len(lst) < 1: break
        category_list.append(response_text)
        page += 1

    template = igetget_config.IGETGET_CATEGORY_PATH
    file_path = template.format(group_type)
    lsieun_util.write(category_list, file_path)