All Samples(145) | Call(98) | Derive(0) | Import(47)
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.
Returns a list, as G-d intended.
def parse_qsl(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.
Returns a list, as G-d intended.
"""
pairs = [s2 for s1 in qs.split('&') for s2 in s1.split(';')]
r = []
for name_value in pairs:
if not name_value and not strict_parsing:
continue
nv = name_value.split('=', 1)
if len(nv) != 2:
if strict_parsing:
raise ValueError, "bad query field: %r" % (name_value,)
# Handle case of a control-name with no equal sign
if keep_blank_values:
nv.append('')
else:
continue
if len(nv[1]) or keep_blank_values:
name = unquote(nv[0].replace('+', ' '))
value = unquote(nv[1].replace('+', ' '))
r.append((name, value))
return r
# -*- coding: utf-8 -*- from urllib import urlencode from urlparse import parse_qsl import httplib2 import oauth2 from webob import Request, Response
# Create the response body for this page based on the protected
# resource data.
body = ""
resp_data = dict(parse_qsl(content))
# Display the protected resource's response data on the page.
body += '<br />'.join([ "<div><b>%s</b></div>%s</div>" %
(k, v) for k, v in resp_data.iteritems() ])
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/n/a/nanozio-HEAD/nanozio/system/input.py nanozio(Download)
''' Created on Aug 17, 2009 @author: nodren ''' from urlparse import parse_qsl from singleton import Singleton
def parse(self, string):
dict = {}
for name, value in parse_qsl(string, True):
dict[name] = value
return dict
src/r/e/restkit-HEAD/restkit/util/oauth2.py restkit(Download)
import binascii
try:
from urlparse import parse_qs, parse_qsl
except ImportError:
from cgi import parse_qs, parse_qsl
src/h/l/hltbra_on_appengine-HEAD/yql/__init__.py hltbra_on_appengine(Download)
try:
from urlparse import parse_qs, parse_qsl
except ImportError:
from cgi import parse_qs, parse_qsl
src/r/e/restkit-HEAD/restkit/filters/oauth2.py restkit(Download)
import re
import urlparse
try:
from urlparse import parse_qsl
except ImportError:
from cgi import parse_qsl
src/l/i/LinkedIn-Client-Library-HEAD/liclient/oauth2/__init__.py LinkedIn-Client-Library(Download)
import httplib2
try:
from urlparse import parse_qs, parse_qsl
except ImportError:
from cgi import parse_qs, parse_qsl
src/i/n/inforlearn-python-client-HEAD/oauth2/__init__.py inforlearn-python-client(Download)
import httplib2
try:
from urlparse import parse_qs, parse_qsl
except ImportError:
from cgi import parse_qs, parse_qsl
src/h/l/hltbra_on_appengine-HEAD/oauth2/__init__.py hltbra_on_appengine(Download)
import httplib2
try:
from urlparse import parse_qs, parse_qsl
except ImportError:
from cgi import parse_qs, parse_qsl
src/r/e/restkit-2.2.1/restkit/util/oauth2.py restkit(Download)
import binascii
try:
from urlparse import parse_qs, parse_qsl
except ImportError:
from cgi import parse_qs, parse_qsl
1 | 2 | 3 | 4 | 5 Next