title: how to access javascript variables in python
body: <p>I am creating a facebook app and it uses Javascript API to store username and other details in js variables. And this app is created under Python(using Google App Engine). I want to access the js variables in Python and store the values in Db. How to do this?</p>
  
  <pre><code>class MainPage(webapp2.RequestHandler):
    def get(self):
      self.response.out.write("""
   &lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://ogp.me/ns/fb#"&gt;
      &lt;head&gt;
        &lt;title&gt;Captain Pandey&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
        &lt;div id="fb-root"&gt;&lt;/div&gt;
        &lt;script&gt;
          window.fbAsyncInit = function() {
            FB.init({
              appId      : '185318768251247',
              channelURL : 'http://localhost:8080/channel.html',
              status     : true, 
              cookie     : true,
              xfbml      : true,
              oauth      : true,
            });
  
  
  
           FB.getLoginStatus(function(response) {
            if (response.status === 'connected') {
              // the user is logged in and has authenticated your
              // app, and response.authResponse supplies
              // the user's ID, a valid access token, a signed
              // request, and the time the access token 
              // and signed request each expire
              var uid = response.authResponse.userID;
              var accessToken = response.authResponse.accessToken;
              FB.api('/me', function(apiResponse) {
                var name = apiResponse.name;
              });
            } 
            else if (response.status === 'not_authorized') {
              // the user is logged in to Facebook, 
              // but has not authenticated your app
            }
            else {
            // the user isn't logged in to Facebook.
            }
         });
  
          };
  
          (function(d){
             var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
             js = d.createElement('script'); js.id = id; js.async = true;
             js.src = "//connect.facebook.net/en_US/all.js";
             d.getElementsByTagName('head')[0].appendChild(js);
           }(document));
        &lt;/script&gt;
        &lt;div class="fb-login-button" data-show-faces="true" data-width="200" data-max-rows="1" scope="email"&gt;Login to Facebook&lt;/div&gt;
      &lt;/body&gt;
   &lt;/html&gt;
      """)
  </code></pre>
  
  <p>and template used is webapp2</p>