Coretex
coretex.networking.network_response.NetworkResponse Class Reference

Public Member Functions

bool hasFailed (self)
 
bool isUnauthorized (self)
 

Detailed Description

    Represents Coretex backend response to network request

    Properties
    ----------
    response : Response
        API response
    endpoint : endpoint
        name of API endpoint
    json : Any
        response in json format

Definition at line 38 of file network_response.py.

Member Function Documentation

◆ hasFailed()

bool coretex.networking.network_response.NetworkResponse.hasFailed (   self)
    Checks if request has failed

    Returns
    -------
    bool -> True if request has failed, False if request has not failed

Definition at line 72 of file network_response.py.

72  def hasFailed(self) -> bool:
73  """
74  Checks if request has failed
75 
76  Returns
77  -------
78  bool -> True if request has failed, False if request has not failed
79  """
80 
81  return not self.raw.ok
82 

◆ isUnauthorized()

bool coretex.networking.network_response.NetworkResponse.isUnauthorized (   self)
    Checks if request was unauthorized

    Returns
    -------
    bool -> True if status code is 401 and request has failed, False if not

Definition at line 83 of file network_response.py.

83  def isUnauthorized(self) -> bool:
84  """
85  Checks if request was unauthorized
86 
87  Returns
88  -------
89  bool -> True if status code is 401 and request has failed, False if not
90  """
91 
92  return self.statusCode == HttpCode.unauthorized and self.hasFailed()
93 
94 

The documentation for this class was generated from the following file: