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 3319214
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T22:47:54+00:00 2026-05-17T22:47:54+00:00

HTTP Post may have multiple params such as: http://example.com/controller/ (while params=({‘country’:’US’},{‘city’:’NYC’}) I am developing

  • 0

HTTP Post may have multiple params such as:

http://example.com/controller/ (while params=({‘country’:’US’},{‘city’:’NYC’})

I am developing a web spider with Python, I face a problem how to track difference with same url with different params. Now I can load the content, but I have no idea how to store the post params in a field of SQLite3 table. It is easy to store the params in database like MySQL for system developer, but since the params of different sites are various. I prefer to store the post params in single field, rather than one-on-one relationship mapping in a table.

HTTP GET

>>> import urllib
>>> params = urllib.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0})
>>> f = urllib.urlopen("http://www.musi-cal.com/cgi-bin/query?%s" % params)
>>> print f.read()

HTTP POST

>>> import urllib
>>> params = urllib.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0})
>>> f = urllib.urlopen("http://www.musi-cal.com/cgi-bin/query", params)
>>> print f.read()

My project configuration:

  • Python + SQLite3
  • Store http url and post params and tracking the changes.
  • The post params contains multiple key-value pairs
  • The stored params should be decoded back to params.
  • The encode issues should be covered.

I saw multiple solutions like JSON, XML and YAML. I guess this format actually stored as string (CHAR) type in SQLite, in UTF-8. But I have no idea if there is any handy way to convert them back to Python tuple type? Or, can I encode the post params into get params with + and & symbal, and decode it back to post params?

Sorry, I am just a newbie for Python.

  • 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-05-17T22:47:55+00:00Added an answer on May 17, 2026 at 10:47 pm

    You can convert to and from json easily like this:

    >>> import json
    >>> json.dumps({'spam': 1, 'eggs': 2, 'bacon': 0})
    '{"eggs": 2, "bacon": 0, "spam": 1}'
    >>> json.loads('{"eggs": 2, "bacon": 0, "spam": 1}')
    {u'eggs': 2, u'bacon': 0, u'spam': 1}
    
    >>> json.dumps((1,2,3,4))
    '[1, 2, 3, 4]'
    >>> json.loads('[1, 2, 3, 4]')
    [1, 2, 3, 4]
    >>> 
    

    Better use it because it is more versatile than home made & separated encoding, it supports any nesting complexity.

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

Sidebar

Related Questions

I'd like to have one server make an http post request to another server.
When programmatically issuing HTTP POST requests, what timeout values would be sensible? In my
When comparing an HTTP GET to an HTTP POST, what are the differences from
I want to do an HTTP POST that looks like an HMTL form posted
What VBA code is required to perform an HTTP POST from an Excel spreadsheet?
Is there any way (in Java Servlet) to determine whether a HTTP POST or
I want to salt a hashed username and password (submitted via http POST) in
I originally used WebRequest and WebResponse to sent Http Post Messages. Always I got
Note: solution at the end If I attempt to do a HTTP POST of
This is what my browser sent, when logging into some site: POST http://www.some.site/login.php HTTP/1.0

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.