How to use the pyquery.openers.HAS_REQUEST function in pyquery

To help you get started, we’ve selected a few pyquery 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 gawel / pyquery / tests / test_pyquery.py View on Github external
def test_session(self):
        if HAS_REQUEST:
            import requests
            session = requests.Session()
            session.headers.update({'X-FOO': 'bar'})
            d = pq(self.application_url, {'q': 'foo'},
                   method='get', session=session)
            self.assertIn('HTTP_X_FOO: bar', d('p').text())
        else:
            self.skipTest('no requests library')