Skip to content
Advertisement

Tag: python-requests

How to trigger a Javascript-generated HTML to show on the page with Python requests?

I’m using the requests module from Python to get a webpage that requires login to access. I know how to have requests enter the login details on a page, but I am having trouble accessing the form fields on this particular page because they are generated by Javascript after clicking a button. Here’s the website in question: https://pennmedialab.getconnect2.com/signin.aspx When first

Trying to get data from a table using beautifulsoup in python

Trying to get the “all splits” line of numbers from https://insider.espn.com/nba/player/splits/_/id/532/type/nba/year/2003/category/perGame (html code is in the picture) my code returns the ‘all splits’ text instead of the numbers I’m looking for. How do I go about changing the lookups in the GetStats function area to get the numbers instead of the first column descriptors. Answer To get the all_splits stats

How can I do a python API request with the body?

if I do a POST request on Postman with my local API server it works: But if I try in python with this syntax it doesn’t work: requests.post(‘http://127.0.0.1:5001/api/v0/add’, data={‘path’: ‘test’}).text it returns: “file argument ‘path’ is requiredn” Can you please explain me why it doesn’t work? Answer The issue is that using data on requests.post defaults to application/x-www-form-urlencoded while your

Advertisement