def fixture():
     session = requests.Session()
     adapter = MiddlewareHTTPAdapter()
     throttle_middleware = throttleware.ThrottleMiddleware(throttler)
     adapter.register(throttle_middleware)
     session.mount('http://', adapter)
     session.mount('https://', adapter)
     return session
def session():
    session = requests.Session()
    adapter = MiddlewareHTTPAdapter()
    cache_middleware = cachecontrolware.CacheMiddleware()
    adapter.register(cache_middleware)
    session.mount('http://', adapter)
    session.mount('https://', adapter)
    return session
Ejemplo n.º 3
0
def session():
    session = requests.Session()
    session.headers['User-Agent'] = 'robot'
    adapter = MiddlewareHTTPAdapter()
    robots_middleware = robotware.RobotsMiddleware()
    adapter.register(robots_middleware)
    session.mount('http://', adapter)
    session.mount('https://', adapter)
    return session