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

All Samples(1396)  |  Call(1238)  |  Derive(0)  |  Import(158)
Quote the query fragment of a URL; replacing ' ' with '+'

        def quote_plus(s, safe=''):
    """Quote the query fragment of a URL; replacing ' ' with '+'"""
    if ' ' in s:
        s = quote(s, safe + ' ')
        return s.replace(' ', '+')
    return quote(s, safe)
        


src/q/u/querychinesesto-HEAD/prog/gbk-encode-example.py   querychinesesto(Download)
u''.encode('gbk')
 
#=========
from urllib import quote, quote_plus, unquote, urlencode
 
value = unicode('','cp936')
 
quote(value.encode('utf-8'), '/')
 
quote_plus(value.encode('utf-8'))

src/p/y/pybriciole-HEAD/qmpy/amazon/storage/s3-example-libraries/python/S3.py   pybriciole(Download)
        buf += "/%s" % bucket
 
    # add the key.  even if it doesn't exist, add the slash
    buf += "/%s" % urllib.quote_plus(key)
 
    # handle special query string arguments
 
def encode(aws_secret_access_key, str, urlencode=False):
    b64_hmac = base64.encodestring(hmac.new(aws_secret_access_key, str, sha).digest()).strip()
    if urlencode:
        return urllib.quote_plus(b64_hmac)
    else:
        return b64_hmac
 
def query_args_hash_to_string(query_args):
    query_string = ""
    pairs = []
    for k, v in query_args.items():
        piece = k
        if v != None:
            piece += "=%s" % urllib.quote_plus(str(v))
 
        # add the slash after the bucket regardless
        # the key will be appended if it is non-empty
        path += "/%s" % urllib.quote_plus(key)
 
 
        # build the path_argument string
 
        url = CallingFormat.build_url_base(self.protocol, self.server, self.port, bucket, self.calling_format)
 
        url += "/%s" % urllib.quote_plus(key)
 
        query_args['Signature'] = encoded_canonical
        query_args['Expires'] = expires

src/t/r/tropo-webapi-python-HEAD/samples/appengine/GoogleS3.py   tropo-webapi-python(Download)
        buf += "/%s" % bucket
 
    # add the key.  even if it doesn't exist, add the slash
    buf += "/%s" % urllib.quote_plus(key)
 
    # handle special query string arguments
 
def encode(aws_secret_access_key, str, urlencode=False):
    b64_hmac = base64.encodestring(hmac.new(aws_secret_access_key, str, sha).digest()).strip()
    if urlencode:
        return urllib.quote_plus(b64_hmac)
    else:
        return b64_hmac
 
def query_args_hash_to_string(query_args):
    query_string = ""
    pairs = []
    for k, v in query_args.items():
        piece = k
        if v != None:
            piece += "=%s" % urllib.quote_plus(str(v))
 
        # add the slash after the bucket regardless
        # the key will be appended if it is non-empty
        path += "/%s" % urllib.quote_plus(key)
 
 
        # build the path_argument string
 
        # add the slash after the bucket regardless
        # the key will be appended if it is non-empty
        path += "/%s" % urllib.quote_plus(key)
 
 
        # build the path_argument string
 
        url = CallingFormat.build_url_base(self.protocol, self.server, self.port, bucket, self.calling_format)
 
        url += "/%s" % urllib.quote_plus(key)
 
        query_args['Signature'] = encoded_canonical
        query_args['Expires'] = expires

src/r/e/REST-Client-HEAD/sample/webapi/rest.py   REST-Client(Download)
    def setPathParam(self,key,value=None):
        """
        Twitterのようなパス形式のパラメーターを追加
 
        """
        value=urllib.quote_plus(value.encode('utf-8'))
        self.__addParams('pathparam',key,value,False)
                        dup[key]=value
                        continue
 
                qs=key+"="+urllib.quote_plus(value.encode('utf-8'))
                querys.append(qs)
 
            if dup:
 
                for key,values in dup.iteritems():
                    for value in value:
                        qs=key+"="+urllib.quote_plus(value.encode('utf-8'))

src/r/e/remoteobjects-1.1.1/examples/twitter.py   remoteobjects(Download)
import httplib
from optparse import OptionParser
import sys
from urllib import urlencode, quote_plus
from urlparse import urljoin, urlunsplit
 
from httplib2 import Http
    def get_user(cls, http=None, **kwargs):
        url = '/users/show'
        if 'id' in kwargs:
            url += '/%s.json' % quote_plus(kwargs['id'])
        else:
            url += '.json'
        query = urlencode(filter(lambda x: x in ('screen_name', 'user_id'), kwargs))
    def get_related(cls, relation, http=None, **kwargs):
        url = '/statuses/%s' % relation
        if 'id' in kwargs:
            url += '/%s.json' % quote_plus(kwargs['id'])
        else:
            url += '.json'
        query = urlencode(filter(lambda x: x in ('screen_name', 'user_id', 'page'), kwargs))
    def user(cls, http=None, **kwargs):
        url = '/statuses/user_timeline'
        if 'id' in kwargs:
            url += '/%s.json' % quote_plus(kwargs['id'])
        else:
            url += '.json'
        query = urlencode(filter(lambda x: x in ('screen_name', 'user_id', 'since_id', 'max_id', 'page'), kwargs))

src/p/k/pksampler-HEAD/pk/stereo/PyCDDB.py   pksampler(Download)
    def query(self, discid):
        if discid != "":
            result = []
            self.track_offset = map(string.atoi, string.split(discid)[2:-1])
            self.disc_length = string.atoi(string.split(discid)[-1:][0]) * 75
            query = urllib.quote_plus(string.rstrip(discid))
            url = "%s?cmd=cddb+query+%s&hello=%s+%s+%s+%s&proto=%d" % \

src/m/e/mendeley-oapi-example-HEAD/mendeley_client.py   mendeley-oapi-example(Download)
				raise ValueError('Missing required args')
 
			for (key, value) in required_args.items():
				required_args[key] = urllib.quote_plus(str(value))
 
			url = url % required_args
 

src/b/i/BigBlueButton-PythonExample-HEAD/api.py   BigBlueButton-PythonExample(Download)
#! coding: utf-8
# pylint: disable-msg=W0311
from uuid import uuid4
from time import time
from random import randint
from hashlib import md5, sha1
from urllib import urlopen, quote_plus
def _create(name, meeting_id, attendee_pw, moderator_pw):
  query = "name=%s&meetingID=%s&attendeePW=%s&moderatorPW=%s&logoutURL=%s" % \
          (quote_plus(name), meeting_id, attendee_pw, moderator_pw, settings.logout_url)
  api_uri = "create?%s" % query
  uri = get_secure_uri(api_uri)
  url = api_prefix + uri
  return_code = xml2dict(urlopen(url).read()).get("returncode")

src/p/a/parallel-python-example-HEAD/selenium.py   parallel-python-example(Download)
    def do_command(self, verb, args):
        conn = httplib.HTTPConnection(self.host, self.port)
        body = u'cmd=' + urllib.quote_plus(unicode(verb).encode('utf-8'))
        for i in range(len(args)):
            body += '&' + unicode(i+1) + '=' + urllib.quote_plus(unicode(args[i]).encode('utf-8'))
        if (None != self.sessionId):
            body += "&sessionId=" + unicode(self.sessionId)

src/u/l/uliweb-HEAD/uliweb/lib/werkzeug/utils.py   uliweb(Download)
            else:
                value = str(value)
            tmp.append('%s=%s' % (urllib.quote(key),
                                  urllib.quote_plus(value)))
    return '&'.join(tmp)
 
 
        s = s.encode(charset)
    elif not isinstance(s, str):
        s = str(s)
    return urllib.quote_plus(s, safe=safe)
 
 
def url_unquote(s, charset='utf-8', errors='ignore'):
        s = s.encode(charset, 'ignore')
    scheme, netloc, path, qs, anchor = urlparse.urlsplit(s)
    path = urllib.quote(path, '/%')
    qs = urllib.quote_plus(qs, ':&=')
    return urlparse.urlunsplit((scheme, netloc, path, qs, anchor))
 
 

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