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
import httplib2
try:
from urlparse import parse_qs, parse_qsl
except ImportError:
from cgi import parse_qs, parse_qsl
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/f/r/frontik-HEAD/src/frontik/handler.py frontik(Download)
def fetch_url(self, url, callback=None):
"""
Прокси метод для get_url, логирующий употребления fetch_url
"""
from urlparse import parse_qs, urlparse
self.log.error("Used deprecated method `fetch_url`. %s", traceback.format_stack()[-2][:-1])
scheme, netloc, path, params, query, fragment = urlparse(url)
new_url = "{0}://{1}{2}".format(scheme, netloc, path)
query = parse_qs(query)
src/g/r/graphit-0.6/graphit/server.py graphit(Download)
from urllib import unquote from base64 import b64decode from datetime import datetime, timedelta from urlparse import urlparse, parse_qs from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler '''
url_path = urlparse(self.path)
path = [unquote(x).decode('utf8')
for x in url_path.path.strip('/').split('/')]
options = parse_qs(url_path.query)
# Default values :
since = timedelta(seconds=3600)
url_path = urlparse(self.path)
path = [unquote(x).decode('utf8').replace('%2F', '/')
for x in url_path.path.strip('/').split('/')]
options = parse_qs(url_path.query)
# Authentication stuff:
if self.server._graphit_server.need_auth():
src/s/3/s3_post_uploadify-HEAD/server.py s3_post_uploadify(Download)
#! /usr/bin/env python from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer from uuid import uuid4 from base64 import b64decode from urlparse import urlparse, parse_qs, urlunparse from urllib import urlencode import os
def do_POST(self):
parsed = urlparse(self.path)
d = parse_qs(parsed.query)
global g_uploaded_keys
g_uploaded_keys += d['key']
self.send_response(200)
self.end_headers()
src/k/i/kiwiipy-HEAD/kiwii/dispatchers.py kiwiipy(Download)
import os import sys from urlparse import parse_qs class TreeDispatcher(object): def __init__(self): self.tree = []
if hasattr(controller, 'index'):
ret = getattr(controller, 'index')
args = ()
kwargs = parse_qs(query_string)
return (ret, args, kwargs, path)
else:
return (None, (), {}, None)
ret = c
args = tuple(url_parts[i:])
kwargs = parse_qs(query_string)
return (c, args, kwargs, path)
return (None, (), {}, None)
src/p/a/paypal-python-HEAD/paypal/response.py paypal-python(Download)
# coding=utf-8 """ PayPalResponse parsing and processing. """ from urlparse import parse_qs
"""
# A dict of NVP values. Don't access this directly, use
# PayPalResponse.attribname instead. See self.__getattr__().
self.raw = parse_qs(query_string)
self.config = config
def __str__(self):
src/e/x/exscript-HEAD/src/Exscriptd/HTTPDaemon.py exscript(Download)
from traceback import format_exc from HTTPDigestServer import HTTPRequestHandler, HTTPServer from lxml import etree from urlparse import parse_qs from Daemon import Daemon from Order import Order from Exscript import Host
def get_response(self):
data = parse_qs(self.data)
if self.path == '/order/':
self.daemon.logger.debug('Parsing order from REST request.')
order = Order.from_xml(data['xml'][0])
self.daemon.logger.debug('XML order parsed complete.')
self.daemon._place_order(order)
src/p/y/python-bittorrent-HEAD/tracker.py python-bittorrent(Download)
from socket import inet_aton from struct import pack from urllib import urlopen from urlparse import parse_qs from bencode import encode from simpledb import Database
elif path[:2] == "/?": path = path[2:] return parse_qs(path) def add_peer(torrents, info_hash, peer_id, ip, port): """ Add the peer to the torrent database. """
src/o/x/ox-2.0.160/ox/web/youtube.py ox(Download)
# -*- coding: utf-8 -*- # vi:si:et:sw=4:sts=4:ts=4 from urllib import quote, unquote import httplib import xml.etree.ElementTree as ET import re from urlparse import parse_qs
def getVideoKey(youtubeId):
for el_type in ['&el=embedded', '&el=detailpage', '&el=vevo', '']:
video_info_url = 'http://www.youtube.com/get_video_info?&video_id=%s%s&ps=default&eurl=&gl=US&hl=en' % (youtubeId, el_type)
try:
data = readUrl(video_info_url)
video_info = parse_qs(data)
if 'token' in video_info:
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next