Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8499333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:38:17+00:00 2026-06-11T00:38:17+00:00

In the post method of a RequestHandler in Tornado, self.get_argument(arg, None) gets the value

  • 0

In the post method of a RequestHandler in Tornado, self.get_argument(arg, None) gets the value of arg contained in the request.

All the examples I’ve seen return a string as value, which makes me wonder if we can send data other than strings in a POST request.

The specific use case I am interested in: I have a form with multiple fields on the page, and I want to pack a subset of its fields together in a single argument in the POST request to the server, something like

packed = self.get_argument('packed_arg', None)
arg1 = packed['arg1']
arg2 = packed['arg2']
...

while the rest of the fields are still of individual arguments. So far I’m thinking data structure similar to a dict (maybe JSON?) for this packed argument, is this feasible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T00:38:19+00:00Added an answer on June 11, 2026 at 12:38 am

    JSON will fit well for your purposes.

    Do something like this, on client side:

    var data = {'packed_arg':get_form_args(); } 
    

    Function get_form_args() is abstraction. You can implement it any way. Javascript objects are JSONs by default.
    So on client side you must create dictionary from form fields.
    Think this way:

    var data = {};
    var names_to_pack = ['packed1', 'packed2']
    $(form).find('input, select').each(function (i, x) {
        var name = $(x).attr('name')
        if(names_to_pack.indexOf(name) != -1) { 
            if(!data.packed) {
                data.packed = {};  
            }
            data['packed'][name] = $(x).val(); 
        } else { 
            data[name] = $(x).val(); 
        }
    });
    $.post('/', data); 
    

    And then on server side:

    raw_packed = self.get_argument('packed_arg', None)
    packed = {}
    if raw_packed: 
        packed = tornado.escape.json_decode(raw_packed)
    arg1 = packed.get('arg1')
    arg2 = packed.get('arg2')
    

    Also you can access all POST args in self.request.arguments.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a AJAX post method that gets xml data from server. But when
I´ve got a controller which gets an JsonObject from a POST method, parses it
I have write an simple python application on GAE. class Upload(webapp2.RequestHandler): def post(self): self.response.out.write('HelloWorld')
Can PHP array passed POST method to catch in ASP.NET MVC? Query string: WebAccess/ArrayTest?val[]=1&val[]=2&val[]=3
I'm doing a Get and Post method for an android project and I need
I have created a Webpage which will post as post method..not as get method.
In my iphone application I am calling (by SOAP post method) a web service
I have made a form validation using ajax post method. But i got the
I am looking at the Moneris Payment Processing and their Direct Post method. For
I have a html form with the data by this post method 'form id='form1'

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.