Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #75006
| Date | 2014-07-22 20:09 +0300 |
|---|---|
| Subject | Review my asyncio code |
| From | Yaşar Arabacı <yasar11732@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.12186.1406048959.18130.python-list@python.org> (permalink) |
Hi, I am trying to learn how to utilize aysncio module. In order to do that, I wrote a class that checks http status codes for all the pages on a given domain (unless there is no internal link pointing to it of course). Since it is too long to paste here, I uploaded it to my github repo, you can find it here; https://github.com/yasar11732/python-scripts/blob/master/asyncio-scripts/validate_links.py I was wondering if someone could review it and give me some pointers if necessary. The parts that I especially ask for guidance is firstly how I run my tasks in lines 40-48 I am adding new tasks as I found unvisited links, in line 132. The main problem I find with my code, but can't quite fix it yet, is that run method is blocking. But if I don't use a method like that, I don't know how I would guarantee that event loop is done. I thought about making the whole RecursiveStatusChecker class a Thread, but I am not sure how would Threads and asyncio work together. My ultimate aim with a class like that was to start it at some time, and check later whether or not new results are available or all the tasks are finished. Any help is appreciated. -- http://ysar.net/
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Review my asyncio code Yaşar Arabacı <yasar11732@gmail.com> - 2014-07-22 20:09 +0300
csiph-web