Advertisement
Guest User

Untitled

a guest
Aug 30th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1.  
  2. import asyncio
  3. import aiopg
  4.  
  5. dsn = 'dbname=aiopg user=aiopg password=passwd host=127.0.0.1'
  6.  
  7. async def go():
  8. with aiopg.create_pool(dsn) as pool:
  9. with pool.acquire() as conn:
  10. with conn.cursor() as cur:
  11. await cur.execute("SELECT 1")
  12. ret = []
  13. for row in cur:
  14. ret.append(row)
  15. requests.post(url)
  16. ret == [(1,)]
  17.  
  18. loop = asyncio.get_event_loop()
  19. loop.run_until_complete(go())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement