Sep-29-2019, 02:46 PM
Please help to formulate the correct request query. Thank you.
.
Here is the website
http://www.eatonpowersource.com/cross-reference/
.
one needs to enter a search parameter in the form
[Image: pic1.png]
.
This is how the website looks like
.
.
[Image: pic2.png]
.
in Mozilla there are two variants in the field analysis: POST and GET
Method : POST
Link: http://www.eatonpowersource.com/cross-re...e/results/
Parameters
Criteria.SiteSearchTerm
Criteria.CurrentPageNumber=1
Criteria.FilterOptions.SortBy=CompetitorPartNumber
Criteria.FilterOptions.SortOrder=Asc
Criteria.CompetitorPartNumber=0330D0
Criteria.FilterOptions.PageSize=25
and
Method: GET
Link:
http://www.eatonpowersource.com/cross-re...9680055925
Параметры
Criteria.SiteSearchTerm=
Criteria.CurrentPageNumber=1
Criteria.FilterOptions.SortBy=CompetitorPartNumber
Criteria.FilterOptions.SortOrder=Asc
Criteria.CompetitorPartNumber=0330D0
Criteria.FilterOptions.PageSize=25
_=1569680055925
If I send a request query with GET parameters and method, I get the following
[Image: pic3.png]
this is not what is needed
If I send a request query with POST parameters and method, then I get
either 404 - page not found
or error 500
.
.
Here is the website
http://www.eatonpowersource.com/cross-reference/
.
one needs to enter a search parameter in the form
[Image: pic1.png]
.
This is how the website looks like
.
.
[Image: pic2.png]
.
in Mozilla there are two variants in the field analysis: POST and GET
Method : POST
Link: http://www.eatonpowersource.com/cross-re...e/results/
Parameters
Criteria.SiteSearchTerm
Criteria.CurrentPageNumber=1
Criteria.FilterOptions.SortBy=CompetitorPartNumber
Criteria.FilterOptions.SortOrder=Asc
Criteria.CompetitorPartNumber=0330D0
Criteria.FilterOptions.PageSize=25
and
Method: GET
Link:
http://www.eatonpowersource.com/cross-re...9680055925
Параметры
Criteria.SiteSearchTerm=
Criteria.CurrentPageNumber=1
Criteria.FilterOptions.SortBy=CompetitorPartNumber
Criteria.FilterOptions.SortOrder=Asc
Criteria.CompetitorPartNumber=0330D0
Criteria.FilterOptions.PageSize=25
_=1569680055925
If I send a request query with GET parameters and method, I get the following
[Image: pic3.png]
this is not what is needed
If I send a request query with POST parameters and method, then I get
either 404 - page not found
or error 500
.
# function for web query and recording into a file
def fg_list_bot(_name_element, _output_file):
s = requests.Session()
_data = {"Criteria.SiteSearchTerm":"",
"Criteria.CurrentPageNumber":"1",
"Criteria.FilterOptions.SortBy":"CompetitorPartNumber",
"Criteria.FilterOptions.SortOrder":"Asc",
"Criteria.CompetitorPartNumber":_name_element,
"Criteria.FilterOptions.PageSize":"25",
"_":"1569680055925"}
r = requests.post("_Url", data=_data)
with open(_output_file, "w") as f: f.write(r.text)
print(r.status_code)
input()
import requests
from bs4 import BeautifulSoup
_url = "http://www.eatonpowersource.com/cross-reference/results/"
_name_element = "0330D0" # text of the search request
_output_file = "Eaton_Vickers.html"
fg_list_bot(_name_element, _output_file)
