diff options
author | Nejc Habjan <nejc.habjan@siemens.com> | 2022-05-04 00:16:41 +0200 |
---|---|---|
committer | Nejc Habjan <nejc.habjan@siemens.com> | 2022-12-11 13:33:02 +0100 |
commit | 097997a6fd4a5e09474b3bffd48d879491018361 (patch) | |
tree | e6015c0323b4f597f7241d5d3c4493a934cc2537 /gitlab/graphql/transport.py | |
parent | c7cf0d1f172c214a11b30622fbccef57d9c86e93 (diff) | |
download | gitlab-feat/graphql.tar.gz |
feat: add basic GraphQL support (wip)feat/graphql
Diffstat (limited to 'gitlab/graphql/transport.py')
-rw-r--r-- | gitlab/graphql/transport.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gitlab/graphql/transport.py b/gitlab/graphql/transport.py new file mode 100644 index 0000000..26c3700 --- /dev/null +++ b/gitlab/graphql/transport.py @@ -0,0 +1,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 |