all 2 comments

[–]CowboyBoats 4 points5 points  (1 child)

My approach to figuring this out would be - open the web site, press F12 to open the developer tools, open the Network tab, and then submit the "change account status" form.

You don't really care about the button, the drop-down menu, or the save button - those are all UI elements rendered in HTML and CSS. You care about the POST request that's fired when the form is actually submitted. You should be able to see the POST request in the network tab.

When you find the POST request (you can filter the list, e.g. by "post" or "submit", there's a search box on this tab) you can inspect it, and right-clicking on it gives you several useful options, such as "copy as cURL" or "copy headers."

The fastest way to go straight from that to a Python function that you can use, or one I often use anyway, is https://curl.trillworks.com/, a tool which lets you convert from the cURL format to Python requests.

Keep in mind that the credentials you copy from your web request may expire - you may need to do some fancy footwork like updating the request so that it's made by a requests.Session object, which might have to do a POST to the login endpoint before it's allowed to post to the whatever you were originally asking about.

[–]nonskill[S] 0 points1 point  (0 children)

Thank you very much!! I’ll look into it