title: python Script for getting a captcha
body: <p>So i was doing this site scraping for my app. I need to download the captcha image for displaying it to the user. But every time I visit the captcha url it generates a new captcha. How can I download the the dynamically generated captcha for automated Login</p>
  
  <p>eg:<a href="https://academics.vit.ac.in/student/stud_login.asp" rel="nofollow">https://academics.vit.ac.in/student/stud_login.asp</a></p>
  
  <p>Here I download the captcha using below script>>></p>
  
  <pre><code>from bs4 import BeautifulSoup
  import urllib2
  import urllib
  
  url = "https://academics.vit.ac.in/student/stud_login.asp"
  content = urllib2.urlopen(url)
  soup = BeautifulSoup(content)
  img = soup.find('img',id ='imgCaptcha')
  print img
  urllib.urlretrieve(img['src'],'captcha.bmp')
  </code></pre>
  
  <p>But some how this script doesn't seem to work.</p>
  
  <p>1) One solution is to take screenshot and crop out the captcha.
  But I need a different solution as I am going to work on devices with various screen sizes so taking screen shot would not solve the purpose.</p>