After you increment numeruks you should reset the adresiuks.
I.E.:
adresiuks="http://localhost/" + str(numeruks) + ".jpg"
try:
if numeruks < 150:
numeruks = numeruks + 1
adresiuks = "http://localhost/" + str(numeruks) + ".jpg"
print adresiuks
urllib2.urlopen(adresiuks).read()
Double check the file is available using your web browser.
For example my web server is listening on port 8000 so I have to add the port, i.e.
http://localhost:8000/123.jpg
.
Here is a simple running script, because it is a .jpg it will be garbage that is printed:
import urllib2
numeruks = 123
adresiuks = "http://localhost/" + str(numeruks) + ".jpg"
print adresiuks
thefile = urllib2.urlopen(adresiuks).read()
print thefile