Skip to content

Commit

Permalink
Check for content length returned being 0
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewn committed Jun 8, 2012
1 parent 54cd2ff commit 1263cc5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion printer.py
Expand Up @@ -48,13 +48,20 @@ def checkForDownload():

print "Checking for download: " + url
response = urllib2.urlopen(req)

content_length = int(response.info()['Content-length'])

print "Content length: " + str(content_length)

status = str( response.getcode() )

print "Status: " + status

if status == '200':
if status == '200' and content_length > 0:
print "has response"
sendToPrinter(response)
elif content_length == 0:
print "content length was 0"
else:
print "got response: " + status
time.sleep(5)
Expand Down

0 comments on commit 1263cc5

Please sign in to comment.