Is using requests post method the correct way to fill in a search box on a website?
I have been reading the docs and they all seem to suggest using the requests get method adding the search query to the url.
The problem I have is the website uses a search box which I need to put text in (I think). So I need to
The site uses json as well and I am not sure if that would make a difference to how the code would need done.
Any help with what I should be looking at would be greatly appreciated.
(https://online.transport.wa.gov.au/webEx...20409949?0)
This is the page that the search box is on.
https://online.transport.wa.gov.au/webEx...ket/page?1
This is the results page after a search.
I can use selenium to carry out what I want to do but I want to do it with just python and requests as selenium is not compatible with my iPhone and Pythonista.
I could use mechanize, but I would still prefer to do it with just python.
https://online.transport.wa.gov.au/webEx...1684915326
This is from inspecting the header after I have pasted in the full Rego
https://online.transport.wa.gov.au/webEx...tration/?0
This is what the URL looks like before any information is passed into the search box.
I assume i need to do something with this part of the URL
-1.IBehaviorListener.2-layout-layout_body-registrationRequestForm-plate&random=0.49404731684915326)
I don't understand how I can replace the plate&random.
The request content type is
application/x-www-form-urlencoded;charset=UTF-8
requests.post('https://httpbin.org/post', data={'key':'value'})
Can anyone explain this for me? I think i need to fill the dictionary with the rego something like
requests.post('https://online.transport.wa.gov.au/webExternal/registration/post', data={'plate' : 'rego'}
Getting confused cant rreally locate an example of what i am trying to do
Seems to pull some stuff back but not what i want…
And also says page has expired
I have been reading the docs and they all seem to suggest using the requests get method adding the search query to the url.
The problem I have is the website uses a search box which I need to put text in (I think). So I need to
- go to page
- Locate search box
- Enter text
- Submit
- Scrape results
The site uses json as well and I am not sure if that would make a difference to how the code would need done.
Any help with what I should be looking at would be greatly appreciated.
(https://online.transport.wa.gov.au/webEx...20409949?0)
This is the page that the search box is on.
https://online.transport.wa.gov.au/webEx...ket/page?1
This is the results page after a search.
I can use selenium to carry out what I want to do but I want to do it with just python and requests as selenium is not compatible with my iPhone and Pythonista.
I could use mechanize, but I would still prefer to do it with just python.
https://online.transport.wa.gov.au/webEx...1684915326
This is from inspecting the header after I have pasted in the full Rego
https://online.transport.wa.gov.au/webEx...tration/?0
This is what the URL looks like before any information is passed into the search box.
I assume i need to do something with this part of the URL
-1.IBehaviorListener.2-layout-layout_body-registrationRequestForm-plate&random=0.49404731684915326)
I don't understand how I can replace the plate&random.
The request content type is
application/x-www-form-urlencoded;charset=UTF-8
requests.post('https://httpbin.org/post', data={'key':'value'})
Can anyone explain this for me? I think i need to fill the dictionary with the rego something like
requests.post('https://online.transport.wa.gov.au/webExternal/registration/post', data={'plate' : 'rego'}
Getting confused cant rreally locate an example of what i am trying to do
import requests URL = "https://online.transport.wa.gov.au/webExternal/registration/?0" rego = "1hdv243" PARAMS = {'plate':rego} response = requests.get(url = URL, params = PARAMS) results = requests.get('https://online.transport.wa.gov.au/webExternal/registration/wicket/page?2') print(response.headers) print(results.json) print(results.content) print(results.text) print(results.headers) print(results.body)Some code i have been trying.
Seems to pull some stuff back but not what i want…
And also says page has expired
Larz60+ write Jan-19-2023, 06:06 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time. Please use BBCode tags on future posts
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time. Please use BBCode tags on future posts