Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7747573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:33:50+00:00 2026-06-01T10:33:50+00:00

I am trying to make a script to login into my check card balance

  • 0

I am trying to make a script to login into my “check card balance” service for my university using python. Basically it’s a web form where we fill-in our PIN and PASS and it shows us how much $$$ is left on our card (for food)…

This is the webpage: [url]http://www.wcu.edu/11407.asp[/url]

This is the form I am filling:

<FORM method=post action=https://itapp.wcu.edu/BanAuthRedirector/Default.aspx><INPUT value=https://cf.wcu.edu/busafrs/catcard/idsearch.cfm type=hidden name=wcuirs_uri> 
<P><B>WCU ID Number<BR></B><INPUT maxLength=12 size=12 type=password name=id> </P>
<P><B>PIN<BR></B><INPUT maxLength=20 type=password name=PIN> </P>
<P></P>
<P><INPUT value="Request Access" type=submit name=submit> </P>
</FORM>

As you will see the fields i need to fill in are:

<input maxlength="12" size="12" type="password" name="id">
<input maxlength="20" type="password" name="PIN">

then I need to press the button:

<input value="Request Access" type="submit" name="submit">

When i do this in my browser, this takes me to another page where it shows my balance and id in simple html…

So I tried to write a python script that would give the the html of that page (so I could parse out the amount of money I have left and print it to the screen)

This is what I have so far:

import urllib                                                                   
import urllib2                                                                  
import sys                                                                      
import cookielib                                                                
import hashlib                                                                  

cookieJar = cookielib.LWPCookieJar()                                            
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookieJar))           

opener.addheaders = [('User-agent', "Mozilla/5.0")]                             

username = "xxxxxxx"                                                          
password = "xxxxxxxx"                                                             
action   = "https://itapp.wcu.edu/BanAuthRedirector/Default.aspx"        

print hashlib.md5(hashlib.md5(password).hexdigest()).hexdigest()                
#url = "http://www.wcu.edu/11407.asp"                                           
url = "http://www.wcu.edu/11407.asp"                                            
form = {"action" : action,                                                      
        "id" : username,                                                        
        "PIN" : password}                                                       

encodedForm = urllib.urlencode(form)                                            
request = urllib2.Request(url, encodedForm)                                     
page = opener.open(request)                                                     
contents = page.read()                                                          

f = open("mycatpage.txt", "w")                                                  
f.write(contents)                                                               
f.close()

Why does’t this work???

Thanks in advance

EDIT
I made a new version of the script, but it gives me an error:

Traceback (most recent call last):
  File "checkbalance3.py", line 20, in <module>
    open("mycatpage.html", 'w').write(opener.open(request))
  File "/usr/lib/python2.7/urllib2.py", line 400, in open
    response = meth(req, response)
  File "/usr/lib/python2.7/urllib2.py", line 513, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python2.7/urllib2.py", line 438, in error
    return self._call_chain(*args)
  File "/usr/lib/python2.7/urllib2.py", line 372, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 521, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 500: Internal Server Error

This is the code:

from urllib import urlopen, urlencode                                           
import urllib2                                                                  

myId = 'xxxxxxxx'                                                              
myPin = 'xxxxxxx'                                                                

data = {                                                                        
            'id':myId,                                                          
            'PIN':myPin,                                                        
            'submit':'Request Access',                                          
            'wcuirs_uri':'https://cf.wcu.edu/busafrs/catcard/idsearch.cfm'      
        }                                                                       

opener = urllib2.build_opener()                                                 
opener.addheaders = [('User-agent','Mozilla/5.0')]                              

url = 'https://itapp.wcu.edu/BanAuthRedirector/Default.aspx'                    
request = urllib2.Request(url, urlencode(data))                                 

open("mycatpage.html", 'w').write(opener.open(request))

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T10:33:51+00:00Added an answer on June 1, 2026 at 10:33 am

    I tried this (seems working, at least no exception):

    from urllib import urlopen, urlencode
    myId = '<your_id_here>'
    myPin = '<your_pin_here>'
    data = {
                'id':myId,
                'PIN':myPin,
                'submit':'Request Access',
                'wcuirs_uri':'https://cf.wcu.edu/busafrs/catcard/idsearch.cfm'
            }
    
    url = 'https://itapp.wcu.edu/BanAuthRedirector/Default.aspx'
    response = urlopen(url, urlencode(data))
    open("mycatpage.txt",'w').write(response.read())
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make a simple login script that will check the inputted username
I am trying automate a login process to my web application using Selenium-Python Client
I'm trying to make an auto login script and I'm stuck on the submit
I'm trying to make a script that will go into a directory and run
I'm trying to make simple script using jquery $post function to pass data to
I have been trying to make an init script using start-stop-daemon. I am stuck
I'm trying to make a PHP script that will check the HTTP status of
I am trying to make an application using AppleScript which can remind to check
i'm new in a web service. i'm trying to make a simple web service
Today I'm trying to make a cron job for some forum login to check

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.