Python Requests (form Filling)
This is the link to a page filling forms... https://anotepad.com/notes/2yrwpi where I have to enter the content in the text area (say)('hello world') and then press save, but all
Solution 1:
You need to login and post to the save url, you also need to pass the note number in the form data:
import requests
save = "https://anotepad.com/note/save"
txt = "Hello World"
login = "https://anotepad.com/create_account"
data = {"action": "login",
"email": "you@whatever.com",
"password": "xxxxxx",
"submit": ""}
# construct the POST request
with requests.session() as s: # Use a Session object.
s.post(login, data) # Login.
form_data = {"number": "2yrwpi",
"notetype": "PlainText",
"noteaccess": "2",
"notequickedit": "false",
"notetitle": "whatever",
"notecontent": txt}
r = s.post(save, data=form_data) # Save note.
r.json()
will give you {"message":"Saved"}
on success. Also if you want to see what notes you have, after logging in, run s.post("https://anotepad.com/note/list").text
.
Post a Comment for "Python Requests (form Filling)"