📌  相关文章
📜  如何在python代码示例中从蜂蜜中获取优惠券

📅  最后修改于: 2022-03-11 14:45:46.768000             🧑  作者: Mango

代码示例1
import requests
#  By Link-Start
def get_coupons(store:str = 'displate') -> list:
    url=f'https://d.joinhoney.com/v3?operationName=web_getStoreByLabel&variables=%7B%22label%22%3A%22{store}%22%7D'
    data=requests.get(url).json()
    coupons = []
    for code in range(len(data['data']['getStoreByLabel']['publicCoupons'])):
        coupons.append(data['data']['getStoreByLabel']['publicCoupons'][code]['code'])
    return coupons
print(get_coupons(store='displate'))