2

I'm trying to make a simple webscaper using Python and the requests library.

r=requests.get(https://nustar.newcastle.edu.au/psp/CS9PRD/EMPLOYEE/HRMS/c/MANAGE_ACADEMIC_RECORDS.STDNT_ACTIVATION.GBL?FolderPath=PORTAL_ROOT_OBJECT.HCSR_RECORDS_AND_REGISTRATION.HCSR_STUDENT_TERM_INFORMATION.HC_STDNT_ACTIVATION_GBL&IsFolder=false&IgnoreParamTempl=FolderPath%2cIsFolder

I would like to POST a search input into this URL, but I'm struggling to work out how.

This is the search box code from the website:

<input id="STDNT_SRCH_EMPLID" class="PSEDITBOX" type="text" maxlength="11" style="width:140px; " value="" tabindex="13" name="STDNT_SRCH_EMPLID"></input>

I assume I have to somehow change value = "" to value = "foo".

Any help will appreciated, thanks.

2 Answers 2

2

See request's quick start here.

import requests
value1='foo'
payload = {'STDNT_SRCH_EMPLID': value1} # 'key2': 'value2' and so on (comma delimited)
r = requests.post("http://yourUrl.org/", data=payload)
print(r.text)
Sign up to request clarification or add additional context in comments.

1 Comment

Using the Requests Library in Python: pythonforbeginners.com/requests/using-requests-in-python
1

Do a network analysis in the developer tool of your browser and copy the curl command of the POST package.

Then you surf to [curl.trillworks.com][1] and convert the curl command by pasting it into a Python POST request.

Inside of your python request you can modify the values.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.