Esempio n. 1
0
 async def getPage(self, url):
     async with RequestManager().session as session:
         async with session.get(url, headers=self.headers) as resp:
             print("java_codeceo 1111", resp.status)
             assert resp.status == 200
             r_body = await resp.text(errors="ignore")
             rp = Response()
             rp.url = url
             rp.body = r_body
             return rp
Esempio n. 2
0
 async def getPage1(self, response):
     self.headers["Referer"] = response["url"].get("upper_url")
     async with RequestManager().session as session:
         async with session.get(response["url"].get("url"), headers=self.headers) as resp:
             print("java_csdn 222", resp.status)
             # print("222url", url.get("url"))
             assert resp.status == 200
             # print("222upper_url", url.get("upper_url"))
             # errors="ignore",忽略非法字符
             r_body = await resp.text(errors="ignore")
             rp = Response()
             rp.url = response["url"].get("url")
             rp.body = r_body
             rp.meta = response["meta"]
             return rp