|
|
发表于 2020-4-1 02:54:22
|
显示全部楼层
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- import os
- import requests
- import time
- is_huo = False
- header={'User-agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36'}
- while not is_huo:
- response = requests.get(url='https://www.moack.co.kr/cart.php?a=add&pid=60', headers=header)
- print(response.encoding)
- if 'Out of Stock' in str(response.content):
- print("*"*30)
- time.sleep(5)
- else:
- is_huo = True
- while is_huo:
- os.system('say "蘑菇独服有货了"')
- time.sleep(1)
复制代码
Mac 下不能用 winsound,用这个。
如果没有安装 requests,要先执行 "pip install requests" 安装 |
|