Closed
Description
- RequestsHTTPTransport's retries option uses requests library.
- RequestsHTTPTransport's HTTP(S) request uses POST method by default.
requests
's max_retries option does not effects with POST method by default.
-
run tshark to catpture packets.
$ sudo tshark -i eth1 'dst host httpstat.us'
-
open another terminal and run retry.py
$ mkdir xxx && cd xxx $ pipenv install gql $ pipenv run python -V 3.9.2 $ vi retry.py $ pipenv run python ./retry.py
-
confirm output of tshark and i can see 1 post request only.
Running as user "root" and group "root". This could be dangerous. Capturing on 'eth1' 1 0.000000000 xxx → xxx TCP 94 57164 → 80 [SYN] Seq=0 Win=64800 Len=0 MSS=1440 SACK_PERM=1 TSval=4064012293 TSecr=0 WS=128 2 0.003444162 xxx → xxx TCP 74 57164 → 80 [ACK] Seq=1 Ack=1 Win=64896 Len=0 3 0.003465623 xxx → xxx TCP 274 POST /500 HTTP/1.1 [TCP segment of a reassembled PDU] 4 0.003475453 xxx → xxx HTTP/JSON 1491 POST /500 HTTP/1.1 , JavaScript Object Notation (application/json) 5 0.233443595 xxx → xxx TCP 74 57164 → 80 [ACK] Seq=1618 Ack=1174 Win=64128 Len=0 6 0.239596636 xxx → xxx TCP 74 57164 → 80 [FIN, ACK] Seq=1618 Ack=1174 Win=64128 Len=0 7 0.243453262 xxx → xxx TCP 74 57164 → 80 [ACK] Seq=1619 Ack=1175 Win=64128 Len=0
retry.py: (to recieve 500 response, use httpstat.us)
from gql import Client, gql
from gql.transport.requests import RequestsHTTPTransport
resp = Client(
transport=RequestsHTTPTransport(
url="http://httpstat.us/500",
retries=3
),
fetch_schema_from_transport=True,
).execute(gql("query { xxx { value }}"))
print(resp)