mirror of https://github.com/tiangolo/fastapi.git
🐛 Fix FastAPI People GitHub Action: set HTTPX timeout for GraphQL query request (#5222)
Co-authored-by: Irfanuddin <irfanuddin@knowledgelens.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
This commit is contained in:
parent
0195bb5706
commit
4cff206ebb
|
|
@ -260,6 +260,7 @@ class Settings(BaseSettings):
|
||||||
input_token: SecretStr
|
input_token: SecretStr
|
||||||
input_standard_token: SecretStr
|
input_standard_token: SecretStr
|
||||||
github_repository: str
|
github_repository: str
|
||||||
|
httpx_timeout: int = 30
|
||||||
|
|
||||||
|
|
||||||
def get_graphql_response(
|
def get_graphql_response(
|
||||||
|
|
@ -270,9 +271,10 @@ def get_graphql_response(
|
||||||
response = httpx.post(
|
response = httpx.post(
|
||||||
github_graphql_url,
|
github_graphql_url,
|
||||||
headers=headers,
|
headers=headers,
|
||||||
|
timeout=settings.httpx_timeout,
|
||||||
json={"query": query, "variables": variables, "operationName": "Q"},
|
json={"query": query, "variables": variables, "operationName": "Q"},
|
||||||
)
|
)
|
||||||
if not response.status_code == 200:
|
if response.status_code != 200:
|
||||||
logging.error(f"Response was not 200, after: {after}")
|
logging.error(f"Response was not 200, after: {after}")
|
||||||
logging.error(response.text)
|
logging.error(response.text)
|
||||||
raise RuntimeError(response.text)
|
raise RuntimeError(response.text)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue