当前位置: 首页>>代码示例>>Python>>正文


Python urllib.urlunquote函数代码示例

本文整理汇总了Python中urllib.urlunquote函数的典型用法代码示例。如果您正苦于以下问题:Python urlunquote函数的具体用法?Python urlunquote怎么用?Python urlunquote使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了urlunquote函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_user_info

  def get_user_info(self, auth_token, auth_verifier=""):
    """Get User Info.

    Exchanges the auth token for an access token and returns a dictionary
    of information about the authenticated user.
    """

    auth_token = urlunquote(auth_token)
    auth_verifier = urlunquote(auth_verifier)

    auth_secret = memcache.get(self._get_memcache_auth_key(auth_token))

    if not auth_secret:
      logging.error("The auth token %s is missing from memcache" % auth_token)

    response = self.make_request(self.access_url,
                                 token=auth_token,
                                 secret=auth_secret,
                                 additional_params={"oauth_verifier":
                                                     auth_verifier})

    # Extract the access token/secret from the response.
    result = self._extract_credentials(response)

    # Try to collect some information about this user from the service.
    user_info = self._lookup_user_info(result["token"], result["secret"])
    user_info.update(result)

    return user_info
开发者ID:ebby,项目名称:brokentv,代码行数:29,代码来源:oauth.py

示例2: get_user_info

	def get_user_info(self, auth_token, auth_verifier=""):
		"""Get User Info.
		Exchanges the auth token for an access token and returns a dictionary
		of information about the authenticated user.
		"""

		auth_token = urlunquote(auth_token)
		auth_verifier = urlunquote(auth_verifier)

		auth_secret = memcache.get(self._get_memcache_auth_key(auth_token))

		if not auth_secret:
			result = AuthToken.gql(""" WHERE token = :1 LIMIT 1 """, auth_token).get()

			if not result:
				logging.error("The auth token %s was not found in our db" % auth_token)
				raise Exception, "Could not find Auth Token in database"
			else:
				auth_secret = result.secret

		response = self.make_request(self.access_url,
                        token=auth_token,
                        secret=auth_secret,
                        additional_params={"oauth_verifier":
                                            auth_verifier})

		# Extract the access token/secret from the response.
		result = self._extract_credentials(response)

		# Try to collect some information about this user from the service.
		user_info = self._lookup_user_info(result["token"], result["secret"])
		user_info.update(result)

		return user_info
开发者ID:pee,项目名称:hpt,代码行数:34,代码来源:twitterauth.py

示例3: _url2path

 def _url2path(self,url):
     """Convert a server-side URL into a client-side path."""
     path = urlunquote(urlparse(url).path)
     root = urlunquote(self._url_p.path)
     path = path[len(root)-1:].decode("utf8")
     while path.endswith("/"):
         path = path[:-1]
     return path
开发者ID:DANCEcollaborative,项目名称:forum-xblock,代码行数:8,代码来源:__init__.py

示例4: get_access_token

	def get_access_token(self, auth_token, auth_verifier):
		auth_token = urlunquote(auth_token)
		auth_verifier = urlunquote(auth_verifier)
		
		response = self.make_request( self.access_url, 
										token=auth_token,
										additional_params={"oauth_verifier": auth_verifier} )
		result = parse_qs(response.content)
		return result["user_id"][0], result["oauth_token"][0], result["oauth_token_secret"][0]
开发者ID:yukixz,项目名称:tweetcntd-gae,代码行数:9,代码来源:oauth.py

示例5: urldecode

def urldecode(qs):
    r = []
    for pair in qs.replace(';', '&').split('&'):
        if not pair: continue
        nv = pair.split('=', 1)
        if len(nv) != 2: nv.append('')
        key = urlunquote(nv[0].replace('+', ' '))
        value = urlunquote(nv[1].replace('+', ' '))
        r.append((key, value))
    return r
开发者ID:caser789,项目名称:cocopot,代码行数:10,代码来源:utils.py

示例6: run

 def run(self, edit):
     for s in self.view.sel():
         if s.empty():
             s = self.view.word(s)
         selected = self.view.substr(s)
         try:
             txt = urlunquote(selected.encode('utf8')).decode('utf8')
         except TypeError:
             txt = urlunquote(selected)
         self.view.replace(edit, s, txt)
开发者ID:titoBouzout,项目名称:hasher,代码行数:10,代码来源:hasher.py

示例7: get_access_token

    def get_access_token(self, auth_token, auth_verifier):
        auth_token = urlunquote(auth_token)
        auth_verifier = urlunquote(auth_verifier)

        response = self.make_request(
            self.access_url, token=auth_token, additional_params={"oauth_verifier": auth_verifier}
        )

        # Extract the access token/secret from the response.
        result = self._extract_credentials(response)
        return result["token"], result["secret"], result["screen_name"]
开发者ID:xwl,项目名称:gtap,代码行数:11,代码来源:oauth.py

示例8: from_parsedurl

 def from_parsedurl(cls, parsedurl, **kwargs):
     auth, host = urllib2.splituser(parsedurl.netloc)
     password = parsedurl.password
     if password is not None:
         password = urlunquote(password)
     username = parsedurl.username
     if username is not None:
         username = urlunquote(username)
     # TODO(jelmer): This also strips the username
     parsedurl = parsedurl._replace(netloc=host)
     return cls(urlparse.urlunparse(parsedurl),
                password=password, username=username, **kwargs)
开发者ID:mjmaenpaa,项目名称:dulwich,代码行数:12,代码来源:client.py

示例9: update_status

  def update_status(self, status,auth_token,auth_verifier=""):
    auth_token = urlunquote(auth_token)
    auth_verifier = urlunquote(auth_verifier)
    global auth_secret
    response = self.make_request(self.access_url,
                                token=auth_token,
                                secret=auth_secret,
                                additional_params={"oauth_verifier":auth_verifier})

    result = self._extract_credentials(response)
    data = self._update_status(result["token"], result["secret"],status)
    return data
开发者ID:dongyuwei,项目名称:oauth4sinaweibo,代码行数:12,代码来源:oauth4sina.py

示例10: get_user_info

  def get_user_info(self, auth_token, auth_verifier=""):
    auth_token = urlunquote(auth_token)
    auth_verifier = urlunquote(auth_verifier)
    global auth_secret
    response = self.make_request(self.access_url,
                                token=auth_token,
                                secret=auth_secret,
                                additional_params={"oauth_verifier":auth_verifier})

    result = self._extract_credentials(response)
    user_info = self._lookup_user_info(result["token"], result["secret"])
    user_info.update(result)
    return user_info
开发者ID:dongyuwei,项目名称:oauth4sinaweibo,代码行数:13,代码来源:oauth4sina.py

示例11: get_user_info

  def get_user_info(self, auth_token, auth_verifier=""):
    """Get User Info.

    Exchanges the auth token for an access token and returns a dictionary
    of information about the authenticated user.
    """

    auth_token = urlunquote(auth_token)
    auth_verifier = urlunquote(auth_verifier)

    auth_secret = memcache.get(self._get_memcache_auth_key(auth_token))

    if not auth_secret:
      result = AuthToken.gql("""
        WHERE
          service = :1 AND
          token = :2
        LIMIT
          1
      """, self.service_name, auth_token).get()

      if not result:
        logging.error("The auth token %s was not found in our db" % auth_token)
        raise Exception, "Could not find Auth Token in database"
      else:
        auth_secret = result.secret

    response = self.make_request(self.access_url,
                                token=auth_token,
                                secret=auth_secret,
                                additional_params={"oauth_verifier":
                                                    auth_verifier})
    key_name = ""
    username = ""
    if self.service_name == 'gdi-acc':
        respdict = parse_qs(response.content)
        username = respdict['user_name']
        key_name = 'id-%s' % uuid4();
    
    # Extract the access token/secret from the response.
    result = self._extract_credentials(response)

    # Try to collect some information about this user from the service.
    #user_info = self._lookup_user_info(result["token"], result["secret"])
    #user_info.update(result)
    
    self.set_cookie(key_name)
    self.set_cookie_username(username[0])
    
    return username[0]
开发者ID:nuhajat,项目名称:chat,代码行数:50,代码来源:oauth.py

示例12: parse_content

def parse_content(content):
  content_dict = {}
  content_pairs = content.split("&")
  for content_pair in content_pairs:
    k,v = content_pair.split("=")
    content_dict[k] = urlunquote(v)
  return content_dict
开发者ID:montsamu,项目名称:bullspec,代码行数:7,代码来源:bullpay.py

示例13: get_access_token

  def get_access_token(self, request_token, verifier):
    """Exchanges a Request Token for an Access Token. Returns (access_token, access_secret).
    
    Note that the access_token and access_secret can be stored, allowing future
    requests to be made without going through the happy OAuth dance again.
    """
    request_token, verifier = urlunquote(request_token), urlunquote(verifier)
    request_secret = self._retrieve_request_secret(request_token)

    access_request = self._make_request(self.access_url,
                                       method            = 'POST',
                                       token             = request_token,
                                       secret            = request_secret,
                                       additional_oauth  = {"oauth_verifier": verifier})
    access_response = self._extract_credentials(access_request)
    return (access_response["token"], access_response["secret"])
开发者ID:jwintersinger,项目名称:twitinerary,代码行数:16,代码来源:ohauth.py

示例14: verify

    def verify(self, request):
        """ verify: Called by the external service to verify you authentication request
        """
        auth_token = urlunquote(request.get("oauth_token"))
        auth_verifier = urlunquote(request.get("oauth_verifier"))

        # Extract the access token/secret from the response.
        response = self._make_request(self.access_token_url, token=auth_token, secret=self.store['oauth_secret'], additional_params={"oauth_verifier": auth_verifier})
        if response.status_code == 200:
            data = self._extract_credentials(response)

            self.user.credentials = OAuth1Credentials(user_token=data['token'], user_secret=data['secret'])

        else:
            raise OAuthClientError(response.status_code, response.content)

        return super(OAuth1Client, self).verify(request)
开发者ID:aadjemonkeyrock,项目名称:memovent,代码行数:17,代码来源:client.py

示例15: get_user_info

  def get_user_info(self, auth_token, auth_verifier=''):
    '''Get User Info.

    Exchanges the auth token for an access token and returns a dictionary
    of information about the authenticated user.
    '''

    auth_token = urlunquote(auth_token)
    auth_verifier = urlunquote(auth_verifier)

    auth_secret = memcache.get(self._get_memcache_auth_key(auth_token))

    if not auth_secret:
      result = AuthToken.gql('''
        WHERE
          service = :1 AND
          token = :2
        LIMIT
          1
      ''', self.service_name, auth_token).get()

      if not result:
        logging.error('The auth token %s was not found in our db' % auth_token)
        raise Exception, 'Could not find Auth Token in database'
      else:
        auth_secret = result.secret

    response = self.make_request(self.access_url,
                                 token=auth_token,
                                 secret=auth_secret,
                                 additional_params={'oauth_verifier':
                                                     auth_verifier})

    # Extract the access token/secret from the response.
    result = self._extract_credentials(response)

    # Try to collect some information about this user from the service.
    user_info = self._lookup_user_info(result['token'], result['secret'])
    user_info.update(result)

    return user_info
开发者ID:maxeng,项目名称:han-ra,代码行数:41,代码来源:oauth.py


注:本文中的urllib.urlunquote函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。