summaryrefslogtreecommitdiff
path: root/gitlab/graphql/transport.py
blob: 26c3700d6c875048f4b7704ed4b7abf3ca187bc2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from typing import Any

import requests
from gql.transport.requests import RequestsHTTPTransport


class GitlabSyncTransport(RequestsHTTPTransport):
    """A gql requests transport that reuses an existing requests.Session.

    By default, gql's requests transport does not have a keep-alive session
    and does not enable providing your own session.

    This transport lets us provide and close our session on our own.
    For details, see https://github.com/graphql-python/gql/issues/91.
    """

    def __init__(self, *args: Any, session: requests.Session, **kwargs: Any):
        super().__init__(*args, **kwargs)
        self.session = session

    def connect(self) -> None:
        pass

    def close(self) -> None:
        pass