Files
pytchat-fork/pytchat/util/__init__.py
55448286+taizan-hokuto@users.noreply.github.com 582c1606c1 Created base files
2019-11-03 08:49:05 +09:00

16 lines
562 B
Python

import requests,json,datetime
from .. import config
def download(cls,url):
_session = requests.Session()
html = _session.get(url, headers=config.headers)
with open(str(datetime.datetime.now().strftime('%Y-%m-%d %H-%M-%S')
)+'test.json',mode ='w',encoding='utf-8') as f:
json.dump(html.json(),f,ensure_ascii=False)
def save(cls,data,filename):
with open(str(datetime.datetime.now().strftime('%Y-%m-%d %H-%M-%S')
)+filename,mode ='w',encoding='utf-8') as f:
f.writelines(data)