How can I know what is the name of the "key" in the dictionary which contain the paramaters for the HTTP POST request?
<p>I'm trying to make a Python script which make a HTTP request with a POST argument.
On this site:</p>

<p><a href="https://www.google.com/movies" rel="nofollow">google.com/movies</a></p>

<p>I'm trying to make a script which use the Google search bar and enter the name of a cinema ("Le grand Rex" is the cinema which I'm looking for)</p>

<p>When I right click and display "inspect Element" on the google search bar, it display:</p>

<pre><code>&lt;input dir="" id="gbqfq" class="gbqfif" name="q" autocomplete="off" value="" placeholder="Search Movies" type="text"&gt;
</code></pre>

<p>I see that the "value" will contain what the user write in the Google search bar. So I add in my dictionary which contain the argument, a key named "value" which contain the cinema I'm looking for ("Le grand rex" in my case) as follow:</p>

<pre><code>#! /usr/bin/env python3                                                                                                                                                                                                                       

import urllib.parse
import urllib.request
from bs4 import BeautifulSoup

url = "https://www.google.com/movies"

value = {
    "name" : "q",
    "dir" : "Le Grand Rex"
    }

data = urllib.parse.urlencode(value)
data = data.encode('ascii')
the_page = urllib.request.Request(url, data)
new = urllib.request.urlopen(the_page)
#                                                                                                                                                                                                                                             
soup = BeautifulSoup(new, 'html.parser')
h2 = soup.find_all("h2")
for element in h2:
    print(element)
</code></pre>

<p>However when I check if I open the right page (more precisely, the page which is supposed to be display when a user type "Le Grand Rex" in the Google movie search bar), but unfortunately it's not the right one. </p>

<p>So:</p>

<p>Is the http reques the adequate way for reach my purpose?</p>

<p>How can I know what is the name of the "key" in the dictionary which contain the paramaters for the HTTP POST request?</p>

<p><a href="https://www.w3.org/TR/html4/interact/forms.html#submit-format" rel="nofollow">The <code>name</code> attribute contains the key.</a></p>

<pre><code>{'q': 'Le Grand Rex'}
</code></pre>

python dictionary beautifulsoup