Reputation: 912
I need to build a scanner which scans given array of urls,and display them on a webpage,url and status code. I'v managed to do this for less than around 50 urls.The problem is when scanning more than that,the script takes more time to run and server returns 504 Gateway Timeout error.
Is there any way to print urls while scanning?,not after all the urls scanned.I'm using python wsgi.
Upvotes: 1
Views: 168
Reputation: 912
I found that i could use Python yield keyword to return the strings separately.like this.without waiting the whole process to complete.
def htmlOut():
yield '<html>'
yield '<body><h1>'
yield 'Hello world'
yield '</h1></body></html>
Upvotes: 1