python-graphql-client
                                
                                
                                
                                    python-graphql-client copied to clipboard
                            
                            
                            
                        Allow status codes, other than 200
Is your feature request related to a problem? Please describe. Currently result.raise_for_status() raises the error but I would like to deal with status codes later on rather than to get an exception from the client. The issue is described here: https://github.com/graphql-python/gql/issues/40
Describe the solution you'd like Add a flag, raise_for_status=True/False in client.execute().
Describe alternatives you've considered Comment out the result.raise_for_status() line
Additional context
I also ran into this issue today as well; in that because of the use of 'raise_for_status', my underlying '400' error (and its message; that would allow me to debug the issue) was eaten/stripped away from me.
Suggested Code change to allow for this functionality to be disabled?
    def execute(
        self,
        query: str,
        variables: dict = None,
        operation_name: str = None,
        headers: dict = {},
        riase_for_status: bool = True,
        **kwargs: Any,
    ):
        """Make synchronous request to graphQL server."""
        request_body = self.__request_body(
            query=query, variables=variables, operation_name=operation_name
        )
        result = requests.post(
            self.endpoint,
            json=request_body,
            headers={**self.headers, **headers},
            **{**self.options, **kwargs},
        )
        if riase_for_status:
            result.raise_for_status()
        return result.json()