• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

All Samples(163)  |  Call(77)  |  Derive(0)  |  Import(86)
Parse a query given as a string argument.

Arguments:

qs: URL-encoded query string to be parsed

keep_blank_values: flag indicating whether blank values in
    URL encoded queries should be treated as blank strings.
    A true value indicates that blanks should be retained as
    blank strings.  The default false value indicates that
    blank values are to be ignored and treated as if they were
    not included.

strict_parsing: flag indicating what to do with parsing errors.
    If false (the default), errors are silently ignored.
    If true, errors raise a ValueError exception.

        def parse_qs(qs, keep_blank_values=0, strict_parsing=0):
    """Parse a query given as a string argument.

        Arguments:

        qs: URL-encoded query string to be parsed

        keep_blank_values: flag indicating whether blank values in
            URL encoded queries should be treated as blank strings.
            A true value indicates that blanks should be retained as
            blank strings.  The default false value indicates that
            blank values are to be ignored and treated as if they were
            not included.

        strict_parsing: flag indicating what to do with parsing errors.
            If false (the default), errors are silently ignored.
            If true, errors raise a ValueError exception.
    """
    dict = {}
    for name, value in parse_qsl(qs, keep_blank_values, strict_parsing):
        if name in dict:
            dict[name].append(value)
        else:
            dict[name] = [value]
    return dict
        


src/p/y/PyCAF-HEAD/examples/http_fibonacci.py   PyCAF(Download)
    def do_POST(self):
        l = int(self.headers['Content-Length'])
        data = self.rfile.read(l)
        form = urlparse.parse_qs(data)
        n = int(form['N'][0])
        f = fib(n)
        msg = RET % (n, f)

src/d/a/dacp-HEAD/examples/dacp.py   dacp(Download)
            sock, addr = self.__sock.accept()
 
            field = parse_http_request(sock.recv(512))
            query = urlparse.parse_qs(urlparse.urlparse(field[1]).query)
 
            req = self.__class__.Request(addr, query['servicename'][0], query['pairingcode'][0])
 

src/m/e/mendeley-oapi-example-HEAD/oauth2/__init__.py   mendeley-oapi-example(Download)
import httplib2
 
try:
    from urlparse import parse_qs, parse_qsl
except ImportError:
    from cgi import parse_qs, parse_qsl
 

src/c/o/coda_network-HEAD/coda_network/oauth/__init__.py   coda_network(Download)
def split_url_string(param_str):
    """Turn URL string into parameters."""
    parameters = urlparse.parse_qs(param_str, keep_blank_values=False)
    for k, v in parameters.iteritems():
        parameters[k] = urllib.unquote(v[0])
    return parameters
 

src/e/x/exscript-HEAD/src/Exscriptd/HTTPDigestServer.py   exscript(Download)
if sys.version_info < (2, 6):
    from cgi import parse_qs
else:
    from urlparse import parse_qs
from SocketServer import ThreadingMixIn, TCPServer
from urlparse import urlparse
from traceback import format_exc
    # Convert parse_qs' str --> [str] dictionary to a str --> str
    # dictionary since we never use multi-value GET arguments
    # anyway.
    multiargs = parse_qs(o.query, keep_blank_values=True)
    for arg, value in multiargs.items():
        args[arg] = value[0]
 

src/i/r/ironruby-HEAD/External.LCA_RESTRICTED/Languages/IronPython/27/Lib/cgi.py   ironruby(Download)
        else:
            qs = ""
        environ['QUERY_STRING'] = qs    # XXX Shouldn't, really
    return urlparse.parse_qs(qs, keep_blank_values, strict_parsing)
 
 
# parse query string function called from urlparse,
# this is done in order to maintain backward compatiblity.
 
def parse_qs(qs, keep_blank_values=0, strict_parsing=0):
    """Parse a query given as a string argument."""
    warn("cgi.parse_qs is deprecated, use urlparse.parse_qs instead",
         PendingDeprecationWarning, 2)
    return urlparse.parse_qs(qs, keep_blank_values, strict_parsing)

src/i/r/ironruby-HEAD/External.LCA_RESTRICTED/Languages/CPython/27/Lib/cgi.py   ironruby(Download)
        else:
            qs = ""
        environ['QUERY_STRING'] = qs    # XXX Shouldn't, really
    return urlparse.parse_qs(qs, keep_blank_values, strict_parsing)
 
 
# parse query string function called from urlparse,
# this is done in order to maintain backward compatiblity.
 
def parse_qs(qs, keep_blank_values=0, strict_parsing=0):
    """Parse a query given as a string argument."""
    warn("cgi.parse_qs is deprecated, use urlparse.parse_qs instead",
         PendingDeprecationWarning, 2)
    return urlparse.parse_qs(qs, keep_blank_values, strict_parsing)

src/y/a/yaaps-HEAD/request.py   yaaps(Download)
    def _parse_args(self):
        query = self.env['QUERY_STRING']
        if self.env['REQUEST_METHOD'] == 'GET':
            self.GET = urlparse.parse_qs(query, keep_blank_values=True)
            self.REQUEST = self.GET
        elif self.env['REQUEST_METHOD'] == 'POST':
            if query:
                self.POST = urlparse.parse_qs(query, keep_blank_values=True)
            else:
                request_body = self.env['wsgi.input'].read()
                self.POST = urlparse.parse_qs(request_body, keep_blank_values=True)

src/p/y/pyvm-HEAD/projects/python_in_a_can/trunk/win32/python-2.7/Lib/cgi.py   pyvm(Download)
        else:
            qs = ""
        environ['QUERY_STRING'] = qs    # XXX Shouldn't, really
    return urlparse.parse_qs(qs, keep_blank_values, strict_parsing)
 
 
# parse query string function called from urlparse,
# this is done in order to maintain backward compatiblity.
 
def parse_qs(qs, keep_blank_values=0, strict_parsing=0):
    """Parse a query given as a string argument."""
    warn("cgi.parse_qs is deprecated, use urlparse.parse_qs instead",
         PendingDeprecationWarning, 2)
    return urlparse.parse_qs(qs, keep_blank_values, strict_parsing)

src/s/t/stackless-HEAD/Lib/cgi.py   stackless(Download)
        else:
            qs = ""
        environ['QUERY_STRING'] = qs    # XXX Shouldn't, really
    return urlparse.parse_qs(qs, keep_blank_values, strict_parsing)
 
 
# parse query string function called from urlparse,
# this is done in order to maintain backward compatiblity.
 
def parse_qs(qs, keep_blank_values=0, strict_parsing=0):
    """Parse a query given as a string argument."""
    warn("cgi.parse_qs is deprecated, use urlparse.parse_qs instead",
         PendingDeprecationWarning, 2)
    return urlparse.parse_qs(qs, keep_blank_values, strict_parsing)

  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9  Next