Hi. I have the below code that update a 'dirpath' and 'cobdate'(calendar) field from a website. When I look at the results from my python script. I can see the correct 'dirpath'. The date value selected is correct(as 2012-01-16) but when it posts or submit, the date comes up incorrectly(20120116)

import urllib
import urllib2
import httplib
import httplib2
import webbrowser

url = 'http://eqgnv.us.xx.com:18080/optionupload/OptionReportOndemandServlet?dirpath=%s&cobdate=%s&submit=submit&operation=submit'

params = urllib.urlencode({
    'dirpath': '/export/data/gpfs/SAReport',
    'cobdate': '2012-01-16'

data = urllib.urlopen(url, params).read()
print data

The result from python is below

Top of the webpage from the results
                <font color="red">On Demand- No Reports to process: OnDemandDate=20120116 DirPath=/export/data/gpfs/SAReport</font>

                        <strong>Select a Directory Path:</strong>

                        <select name='dirpath'>
Bottom of the webpage

                <td><input name='cobdate' id='idCalendar' class='inputBoxStyle'
                        value="2012-01-16" readonly> <img
                        align='absmiddle' onmouseover="fnInitCalendar(this, 'idCalendar')"></td>

                <td><input value="submit" name="submit" type="submit" /><input
                        value="submit" name="operation" type="hidden" /></td>




Please tell me what I am doing wrong. Thank you in advance

5 Years
Discussion Span
Last Post by joehms22

Just a guess: you might want to try escaping the dashes in your original date (use %2D instead of -)

Hope it helps,
- Joe

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.