Flask接口签名sign原理与实例代码浅析
249
2022-08-28
python中的ThreadPoolExecutor(python中的//是什么意思)
#!/bin/env python3import requestsimport datetimeimport threadingimport csvimport jsonimport randomfrom concurrent.futures import ThreadPoolExecutorpool = ThreadPoolExecutor(16)threadLocal = threading.local()reader = csv.reader(open('***.csv'))category = ['wilson1', 'wilson2', 'wilson3']def push(i): initialized = getattr(threadLocal, 'initialized', None) if initialized is None: threadLocal.initialized = True threadLocal.s = requests.Session() threadLocal.s.post( ' json={ 'username': 'admin', 'password': '1' }) category_id = category.index(i[3]) threadLocal.s.post( ' json={ 'category_id': category_id, 'name': i[1], 'author': i[4], })for i in reader: pool.submit(push, i)
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~