0

I'm trying to use python to submit this webform. But this is above my basic python skills and I can't seem to figure out why I'm just getting the original html returned me.

If you submit that form by hand using the parameters I have in my code below, you'll see that the following page contains the words "Results You do not exceed Notice Criteria." When I run the code below though, the output .txt file doesn't contain any of that statement in the html. What am I missing? Thanks

import requests url = r'https://oeaaa.faa.gov/oeaaa/external/gisTools/gisAction.jsp?'\ 'action=showNoNoticeRequiredToolForm' payload = { 'latD': 13, 'latM': 13, 'latS': 13, 'longD': 90, 'longM': 13, 'longS': 13, 'latDir': 'N', 'longDir': 'W', 'datum': 'NAD83', 'siteElevation': 1300, 'unadjustedAgl': 13, 'traverseway': 'NO', 'onAirport': 'false' } r = requests.post(url, data=payload) with open("results.txt", "w") as f: f.write(r.content) 
2
  • What happens when you remove the GET part from the url? So url = r'https://oeaaa.faa.gov/oeaaa/external/gisTools/gisAction.jsp' Commented Mar 29, 2018 at 20:50
  • Hey! That got me on the right track, taking that out finally gave me updated html back which had a height error, turns out there's two hidden parameters I needed to set as well and now it's good to go. Thanks! Commented Mar 29, 2018 at 21:07

1 Answer 1

1

Your URL contains some GET data. Depending on how the webserver is programmed, this may cause the server to load the page for a GET request instead of a POST request.

Removing ?action=showNoNoticeRequiredToolForm from the url will give you the correct response:

url = r'https://oeaaa.faa.gov/oeaaa/external/gisTools/gisAction.jsp' 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.