from PIL import Image
from PIL import ImageEnhance
from pytesser import *
from requests import Session
from StringIO import StringIO

s = Session() # this session will hold the cookies

# here we first login and get our session cookie
s.post("https://w...content-available-to-author-only...o.uk?login",{"username":"username","password":"password"})

# now we're logged in and can request any page
resp = s.get("https://w...content-available-to-author-only...o.uk/levels/extras/captcha1.php")

i = Image.open(StringIO(resp.content))
i.save('captcha1.php.png')

#opens image and resizes it
im = Image.open("captcha1.php.png")
nx, ny = im.size
im2 = im.resize((int(nx*5), int(ny*5)), Image.BICUBIC)
im2.save("temp2.png")

#opens resized image and reads text
image = Image.open('temp2.png')
answer = image_to_string(image)
reverse = answer[::-1]
print reverse

s.post("https://w...content-available-to-author-only...o.uk/levels/captcha/1", {"answer":reverse})