Fetching HTTP GET variables in Python

后端 未结 2 1132
故里飘歌
故里飘歌 2021-01-05 11:25

I\'m trying to set up a HTTP server in a Python script. So far I got the server it self to work, with a code similar to the below, from here.

from BaseHTTPSe         


        
2条回答
  •  梦毁少年i
    2021-01-05 11:55

    Import urlparse and do:

    def do_GET(self):
        qs = {}
        path = self.path
        if '?' in path:
            path, tmp = path.split('?', 1)
            qs = urlparse.parse_qs(tmp)
        print path, qs
    

提交回复
热议问题