|
|

楼主 |
发表于 2020-8-3 15:31:23
|
显示全部楼层
|
- import time
- import aiohttp
- import asyncio
- from lxml import etree
- from rname import mutiname ,namerow
- async def resiger(name):
- async with aiohttp.ClientSession() as session:
- url='http://8.2452.xyz/auth/register'
- data={'email':'[email protected]','name':'qmmju','passwd':'qweasd123','repasswd':'qweasd123','code':'0'}
- data['email']=name+'@qq.com'
- await session.post(url,data=data)
- del data['repasswd']
- del data['name']
- data['code']=''
- print(data)
- #html=etree.HTML(res.text)
- url='http://8.2452.xyz/auth/login'
- await session.post(url,data=data)
- url='http://8.2452.xyz/user/node'
- async with session.get(url) as res:
- res=await res.read()
- html=etree.HTML(res)
- #v1=html.xpath('//*[@id="node-modal-3"]/div/div/div[2]/div[8]/code/text()')[0]
- #v2=html.xpath('//*[@id="node-modal-8"]/div/div/div[2]/div[8]/code/text()')[0]
- v2=html.xpath('//*[@id]/div/div/div[2]/div[8]/code/text()')[0]
- with open('vemss.txt','a+',encoding='utf-8')as f:
- #f.write(v1)
- #f.write('\n')
- f.write(v2)
- f.write('\n')
- async def main():
- t1=time.time()
- ls=[resiger(name) for name in mutiname(10)]
- await asyncio.gather(*ls)
- t=time.time()-t1
- print(t)
- if __name__=='__main__':
- asyncio.run(main())
复制代码 |
|