| | |
query inside a webpage with Python
Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved |
•
•
Join Date: Jan 2009
Posts: 4
Reputation:
Solved Threads: 0
Hi,
I want to perform a search with Python in this site:
http://www.draftexpress.com/search.php
I want to search for a player who's first name is "james".
The problem: The page with the result's url is:
http://www.draftexpress.com/search.php#results
Obviously, when opening this page directly, I don't get the page with the results for "james"...
I need to perform this kind of search automatically in other sites like that, so I don't want any local solution, if there is.
I need to make my program somehow make this query and I don't know how. Do anyone have a suggestion? (A code example would be great).
Help me please...
I want to perform a search with Python in this site:
http://www.draftexpress.com/search.php
I want to search for a player who's first name is "james".
The problem: The page with the result's url is:
http://www.draftexpress.com/search.php#results
Obviously, when opening this page directly, I don't get the page with the results for "james"...
I need to perform this kind of search automatically in other sites like that, so I don't want any local solution, if there is.
I need to make my program somehow make this query and I don't know how. Do anyone have a suggestion? (A code example would be great).
Help me please...
•
•
Join Date: May 2008
Posts: 618
Reputation:
Solved Threads: 98
This is the essential parts of the 'source' for the basic search form extracted from the web page you indicated:
The <form> tells you that the form data is sent to the server via post, and the <input>'s give the field names 'fFIRSTNAME' and 'fLASTNAME'
You then 'encode' the form data and post it to the server.
There's a pretty good article on how to do that here:
http://www.voidspace.org.uk/python/a.../urllib2.shtml
html Syntax (Toggle Plain Text)
<form action="/search.php#results" method="post"> <strong>Basic Search </strong> <strong>First Name:</strong><br> <input name="fFIRSTNAME" type="text" size="10" maxlength="25" value=""> <strong>Last Name:</strong><br> <input name="fLASTNAME" type="text" size="10" maxlength="25" value=""> </form>
The <form> tells you that the form data is sent to the server via post, and the <input>'s give the field names 'fFIRSTNAME' and 'fLASTNAME'
You then 'encode' the form data and post it to the server.
There's a pretty good article on how to do that here:
http://www.voidspace.org.uk/python/a.../urllib2.shtml
![]() |
Other Threads in the Python Forum
- Previous Thread: Google Results and Python
- Next Thread: Edraw max is given away
| Thread Tools | Search this Thread |
abrupt ansi anti approximation assignment avogadro backend beginner binary bluetooth calculator character cmd code customdialog decimals dictionaries dictionary directory drive dynamic error examples excel exe file float format function gnu graphics gui heads homework http ideas import input java launcher leftmouse line linux list lists logging loop module mouse number numbers output parsing path pointer port prime programming progressbar projects push py2exe pygame pyqt python random recursion schedule scrolledtext sqlite statistics stdout string strings sudokusolver sum table terminal text thread threading time tkinter tlapse tricks tuple tutorial twoup ubuntu unicode update urllib urllib2 variable ventrilo wikipedia windows write wxpython xlib





