Python six.moves.urllib_parse 模块,urljoin() 实例源码

我们从Python开源项目中,提取了以下15个代码示例,用于说明如何使用six.moves.urllib_parse.urljoin()

项目:YouPBX    作者:JoneXiong    | 项目源码 | 文件源码
def _normalize_name(self, name):
        """
        Normalizes the name so that paths like /path/to/ignored/../foo.txt
        work. We check to make sure that the path pointed to is not outside
        the directory specified by the LOCATION setting.
        """

        base_path = force_text(self.location)
        base_path = base_path.rstrip('/')

        final_path = urljoin(base_path.rstrip('/') + "/", name)

        base_path_len = len(base_path)
        if (not final_path.startswith(base_path) or
                final_path[base_path_len:base_path_len + 1] not in ('', '/')):
            raise SuspiciousOperation("Attempted access to '%s' denied." %
                                      name)
        return final_path.lstrip('/')
项目:python-anticaptcha    作者:ad-m    | 项目源码 | 文件源码
def createTask(self, task):
        request = {"clientKey": self.client_key,
                   "task": task.serialize(),
                   "softId": self.SOFT_ID,
                   "languagePool": self.language_pool,
                   }
        response = self.session.post(urljoin(self.base_url, self.CREATE_TASK_URL), json=request).json()
        self._check_response(response)
        return Job(self, response['taskId'])
项目:python-anticaptcha    作者:ad-m    | 项目源码 | 文件源码
def getTaskResult(self, task_id):
        request = {"clientKey": self.client_key,
                   "taskId": task_id}
        response = self.session.post(urljoin(self.base_url, self.TASK_RESULT_URL), json=request).json()
        self._check_response(response)
        return response
项目:python-anticaptcha    作者:ad-m    | 项目源码 | 文件源码
def getBalance(self):
        request = {"clientKey": self.client_key}
        response = self.session.post(urljoin(self.base_url, self.BALANCE_URL), json=request).json()
        self._check_response(response)
        return response['balance']
项目:YouPBX    作者:JoneXiong    | 项目源码 | 文件源码
def full_url(self, name):
        name = self._normalize_name(self._clean_name(name))
        name = filepath_to_uri(name)
        full_url = urlparse.urljoin(settings.REMOTE_MEDIA_URL, name)
        log.info('>>> QiniuStorage full_url: %s'%name)
        return full_url
项目:obsoleted-vpduserv    作者:InfraSIM    | 项目源码 | 文件源码
def test_import_moves_error_1():
    from six.moves.urllib.parse import urljoin
    from six import moves
    # In 1.4.1: AttributeError: 'Module_six_moves_urllib_parse' object has no attribute 'urljoin'
    assert moves.urllib.parse.urljoin
项目:obsoleted-vpduserv    作者:InfraSIM    | 项目源码 | 文件源码
def test_import_moves_error_2():
    from six import moves
    assert moves.urllib.parse.urljoin
    # In 1.4.1: ImportError: cannot import name urljoin
    from six.moves.urllib.parse import urljoin
项目:obsoleted-vpduserv    作者:InfraSIM    | 项目源码 | 文件源码
def test_import_moves_error_3():
    from six.moves.urllib.parse import urljoin
    # In 1.4.1: ImportError: cannot import name urljoin
    from six.moves.urllib_parse import urljoin
项目:Deploy_XXNET_Server    作者:jzp820927    | 项目源码 | 文件源码
def test_import_moves_error_1():
    from six.moves.urllib.parse import urljoin
    from six import moves
    # In 1.4.1: AttributeError: 'Module_six_moves_urllib_parse' object has no attribute 'urljoin'
    assert moves.urllib.parse.urljoin
项目:Deploy_XXNET_Server    作者:jzp820927    | 项目源码 | 文件源码
def test_import_moves_error_2():
    from six import moves
    assert moves.urllib.parse.urljoin
    # In 1.4.1: ImportError: cannot import name urljoin
    from six.moves.urllib.parse import urljoin
项目:Deploy_XXNET_Server    作者:jzp820927    | 项目源码 | 文件源码
def test_import_moves_error_3():
    from six.moves.urllib.parse import urljoin
    # In 1.4.1: ImportError: cannot import name urljoin
    from six.moves.urllib_parse import urljoin
项目:six    作者:benjaminp    | 项目源码 | 文件源码
def test_import_moves_error_1():
    from six.moves.urllib.parse import urljoin
    from six import moves
    # In 1.4.1: AttributeError: 'Module_six_moves_urllib_parse' object has no attribute 'urljoin'
    assert moves.urllib.parse.urljoin
项目:six    作者:benjaminp    | 项目源码 | 文件源码
def test_import_moves_error_2():
    from six import moves
    assert moves.urllib.parse.urljoin
    # In 1.4.1: ImportError: cannot import name urljoin
    from six.moves.urllib.parse import urljoin
项目:six    作者:benjaminp    | 项目源码 | 文件源码
def test_import_moves_error_3():
    from six.moves.urllib.parse import urljoin
    # In 1.4.1: ImportError: cannot import name urljoin
    from six.moves.urllib_parse import urljoin
项目:valohai-cli    作者:valohai    | 项目源码 | 文件源码
def prepare_request(self, request):
        url_netloc = urlparse(request.url).netloc
        if not url_netloc:
            request.url = urljoin(self.base_url, request.url)
        return super(APISession, self).prepare_request(request)