muhammedfurkan / TelethonUserBot

with statements can be merged PTC-W0062
Anti-pattern
Major
3 years ago3 years old
Consider merging collapsible With statements`
323
324    @staticmethod
325    async def get_raw(link):
326        async with aiohttp.ClientSession() as session:327            async with session.get(link) as resp:
328                return await resp.read()
Consider merging collapsible With statements`
317
318    @staticmethod
319    async def get_text(link):
320        async with aiohttp.ClientSession() as session:321            async with session.get(link) as resp:
322                return await resp.text()
323
Consider merging collapsible With statements`
311class AioHttp:
312    @staticmethod
313    async def get_json(link):
314        async with aiohttp.ClientSession() as session:315            async with session.get(link) as resp:
316                return await resp.json()
317
Consider merging collapsible With statements`
114
115
116async def postTextToDogBin(text):
117    async with aiohttp.ClientSession() as session:118        async with session.post('https://nekobin.com/api/documents', json={"content": text}) as response:
119            respJson = await response.json()
120            return f"https://nekobin.com/{respJson.get('result').get('key')}.py"