Download data from webpage after POST request - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Download data from webpage after POST request (/thread-15806.html) |
Download data from webpage after POST request - AlDe - Feb-02-2019 Hi, I new to Python, and am trying to automate data download from a webpage. The website (https://hirds.niwa.co.nz/search) needs a set of coordinates to generate the corresponding data. It looks like my POST request is working (not certain of that though) but then I am stuck when I want to download the results of my request. I can print part of the html but not all of it, and from the page source code it seems I have to look into hirds-app to get to the data but I don't know how to do that. Any help appreciated! :) import requests URL = 'https://hirds.niwa.co.nz/search' latitude = -37 longitude = 175 PARAMS = {'idf':'false','latitude':'-37', 'longitude':'175', 'site_name':'Custom Location'} r = requests.post(URL, data= PARAMS) if r.status_code == 200: print("Search successful") print(r.text) print r.headers.get('content-type') else: print("Search failed")from which I get the output:
|