0

There is an API that requires the following request header:

Accept: application/json

And on the website, it says it uses REST protocol and GET HTTP method. I'm currently using Google App Engine (with Python) and trying to make a simple form where user types in the coordinates and when they click on the submit button, it fetches the weather information. How do I add this to the header?

This is my code:

form = '''
<form method="get" action="http://some.website.fakeurl">
    <label>Latitude:
        <input name="lat">
    </label>
    <label>Longitude:
        <input name="lon">
    </label>
    <input type="submit">
</form>
'''

class MainPage(webapp2.RequestHandler):
    def get(self):
        self.response.out.write(form)

And the desired request looks something like this:

Accept: application/json
access_token: 
appKey: **************************

Get Method http://some.website.fakeurl/weather?lon=126.9658000000&lat=37.5714000000
funct7
  • 3,407
  • 2
  • 27
  • 33
  • header modification is not possible with form element. use javascript – Sriram Jan 20 '16 at 09:51
  • Or you could post to GAE, have GAE do the GET with a urfetch, and then render a new page with the weather info. That might be easier if you don't want to learn javascript. – new name Jan 20 '16 at 11:55

0 Answers0