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>


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


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

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

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


</table>

</form>


</body>
</html>

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

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

Hope it helps,
- Joe

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.