Skip to content

Commit e8c46b1

Browse files
authored
Merge branch 'master' into master
2 parents 564065b + d49bd63 commit e8c46b1

File tree

2 files changed

+17
-28
lines changed

2 files changed

+17
-28
lines changed

gql/transport/requests.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ class RequestsHTTPTransport(Transport):
1818
"""
1919

2020
def __init__(
21-
self,
22-
url: str,
23-
headers: Optional[Dict[str, Any]] = None,
24-
cookies: Optional[Union[Dict[str, Any], RequestsCookieJar]] = None,
25-
auth: Optional[AuthBase] = None,
26-
use_json: bool = False,
27-
timeout: Optional[int] = None,
28-
verify: bool = True,
29-
retries: int = 0,
30-
method: str = "POST",
31-
**kwargs,
21+
self, # type: RequestsHTTPTransport
22+
url, # type: str
23+
headers=None, # type: Dict[str, Any]
24+
cookies=None, # type: Union[Dict[str, Any], RequestsCookieJar]
25+
auth=None, # type: AuthBase
26+
use_json=True, # type: bool
27+
timeout=None, # type: int
28+
verify=True, # type: bool
29+
retries=0, # type: int
30+
method="POST", # type: str
31+
**kwargs # type: Any
3232
):
3333
"""Initialize the transport with the given request parameters.
3434

tests/test_client.py

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,8 @@ def test_no_schema_exception():
8181
def test_execute_result_error():
8282

8383
client = Client(
84-
transport=RequestsHTTPTransport(
85-
url="https://countries.trevorblades.com/",
86-
use_json=True,
87-
headers={"Content-type": "application/json"},
88-
),
84+
retries=expected_retries,
85+
transport=RequestsHTTPTransport(url="https://countries.trevorblades.com/",),
8986
)
9087

9188
failing_query = gql(
@@ -110,6 +107,7 @@ def test_http_transport_raise_for_status_error(http_transport_query):
110107
client = Client(
111108
transport=RequestsHTTPTransport(
112109
url="https://countries.trevorblades.com/",
110+
use_json=False,
113111
headers={"Content-type": "application/json"},
114112
)
115113
)
@@ -123,10 +121,7 @@ def test_http_transport_raise_for_status_error(http_transport_query):
123121
def test_http_transport_verify_error(http_transport_query):
124122
client = Client(
125123
transport=RequestsHTTPTransport(
126-
url="https://countries.trevorblades.com/",
127-
use_json=True,
128-
headers={"Content-type": "application/json"},
129-
verify=False,
124+
url="https://countries.trevorblades.com/", verify=False,
130125
)
131126
)
132127
with pytest.warns(Warning) as record:
@@ -139,10 +134,7 @@ def test_http_transport_verify_error(http_transport_query):
139134
def test_http_transport_specify_method_valid(http_transport_query):
140135
client = Client(
141136
transport=RequestsHTTPTransport(
142-
url="https://countries.trevorblades.com/",
143-
use_json=True,
144-
headers={"Content-type": "application/json"},
145-
method="POST",
137+
url="https://countries.trevorblades.com/", method="POST",
146138
)
147139
)
148140

@@ -154,10 +146,7 @@ def test_http_transport_specify_method_valid(http_transport_query):
154146
def test_http_transport_specify_method_invalid(http_transport_query):
155147
client = Client(
156148
transport=RequestsHTTPTransport(
157-
url="https://countries.trevorblades.com/",
158-
use_json=True,
159-
headers={"Content-type": "application/json"},
160-
method="GET",
149+
url="https://countries.trevorblades.com/", method="GET",
161150
)
162151
)
163152

0 commit comments

Comments
 (0)