How to use the cachecontrol.compat.urljoin function in CacheControl

To help you get started, we’ve selected a few CacheControl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ionrock / cachecontrol / tests / test_etag.py View on Github external
def sess(self, url):
        self.etag_url = urljoin(url, "/etag")
        self.update_etag_url = urljoin(url, "/update_etag")
        self.cache = DictCache()
        sess = CacheControl(
            requests.Session(), cache=self.cache, serializer=NullSerializer()
        )
        yield sess

        # closing session object
        sess.close()
github ionrock / cachecontrol / tests / test_vary.py View on Github external
def sess(self, url):
        self.url = urljoin(url, "/vary_accept")
        self.cache = DictCache()
        sess = CacheControl(requests.Session(), cache=self.cache)
        return sess
github ionrock / cachecontrol / tests / test_etag.py View on Github external
def sess(self, url):
        self.etag_url = urljoin(url, "/etag")
        self.update_etag_url = urljoin(url, "/update_etag")
        self.cache = DictCache()
        sess = CacheControl(
            requests.Session(), cache=self.cache, serializer=NullSerializer()
        )
        yield sess

        # closing session object
        sess.close()
github ionrock / cachecontrol / tests / test_etag.py View on Github external
def test_not_modified_releases_connection(self, server, url):
        sess = CacheControl(requests.Session())
        etag_url = urljoin(url, "/etag")
        sess.get(etag_url)

        resp = Mock(status=304, headers={})

        # This is how the urllib3 response is created in
        # requests.adapters
        response_mod = "requests.adapters.HTTPResponse.from_httplib"

        with patch(response_mod, Mock(return_value=resp)):
            sess.get(etag_url)
            assert resp.read.called
            assert resp.release_conn.called
github ionrock / cachecontrol / tests / test_etag.py View on Github external
def sess(self, server, url):
        self.etag_url = urljoin(url, "/etag")
        self.update_etag_url = urljoin(url, "/update_etag")
        self.cache = DictCache()
        sess = CacheControl(
            requests.Session(),
            cache=self.cache,
            cache_etags=False,
            serializer=NullSerializer(),
        )
        return sess
github ionrock / cachecontrol / tests / test_etag.py View on Github external
def sess(self, server, url):
        self.etag_url = urljoin(url, "/etag")
        self.update_etag_url = urljoin(url, "/update_etag")
        self.cache = DictCache()
        sess = CacheControl(
            requests.Session(),
            cache=self.cache,
            cache_etags=False,
            serializer=NullSerializer(),
        )
        return sess