SMART on FHIR Python Client  3.0.0
fhirclient.server.FHIRServer Class Reference

Handles talking to a FHIR server. More...

Inheritance diagram for fhirclient.server.FHIRServer:
fhirclient.fhirreference_tests.MockServer fhirclient.server_tests.MockServer

Public Member Functions

def __init__ (self, client, base_uri=None, state=None)
 
def should_save_state (self)
 
def capabilityStatement (self)
 
def get_capability (self, force=False)
 Returns the server's CapabilityStatement, retrieving it if needed or forced. More...
 
def desired_scope (self)
 
def launch_token (self)
 
def authorize_uri (self)
 
def handle_callback (self, url)
 
def reauthorize (self)
 
def ready (self)
 Check whether the server is ready to make calls, i.e. More...
 
def prepare (self)
 Check whether the server is ready to make calls, i.e. More...
 
def request_json (self, path, nosign=False)
 Perform a request for JSON data against the server's base with the given relative path. More...
 
def request_data (self, path, headers={}, nosign=False)
 Perform a data request data against the server's base with the given relative path. More...
 
def put_json (self, path, resource_json, nosign=False)
 Performs a PUT request of the given JSON, which should represent a resource, to the given relative path. More...
 
def post_json (self, path, resource_json, nosign=False)
 Performs a POST of the given JSON, which should represent a resource, to the given relative path. More...
 
def post_as_form (self, url, formdata, auth=None)
 Performs a POST request with form-data, expecting to receive JSON. More...
 
def delete_json (self, path, nosign=False)
 Issues a DELETE command against the given relative path, accepting a JSON response. More...
 
def raise_for_status (self, response)
 
def state (self)
 Return current state. More...
 
def from_state (self, state)
 Update ivars from given state information. More...
 

Public Attributes

 client
 
 auth
 
 base_uri
 
 session
 

Detailed Description

Handles talking to a FHIR server.

Constructor & Destructor Documentation

def fhirclient.server.FHIRServer.__init__ (   self,
  client,
  base_uri = None,
  state = None 
)

Member Function Documentation

def fhirclient.server.FHIRServer.authorize_uri (   self)
def fhirclient.server.FHIRServer.capabilityStatement (   self)
def fhirclient.server.FHIRServer.delete_json (   self,
  path,
  nosign = False 
)

Issues a DELETE command against the given relative path, accepting a JSON response.

:param str path: The relative URL path to issue a DELETE against :param bool nosign: If set to True, the request will not be signed :returns: The response object

def fhirclient.server.FHIRServer.desired_scope (   self)
def fhirclient.server.FHIRServer.from_state (   self,
  state 
)

Update ivars from given state information.

def fhirclient.server.FHIRServer.get_capability (   self,
  force = False 
)

Returns the server's CapabilityStatement, retrieving it if needed or forced.

def fhirclient.server.FHIRServer.handle_callback (   self,
  url 
)
def fhirclient.server.FHIRServer.launch_token (   self)
def fhirclient.server.FHIRServer.post_as_form (   self,
  url,
  formdata,
  auth = None 
)

Performs a POST request with form-data, expecting to receive JSON.

This method is used in the OAuth2 token exchange and thus doesn't request fhir+json.

:throws: Exception on HTTP status >= 400 :returns: The response object

def fhirclient.server.FHIRServer.post_json (   self,
  path,
  resource_json,
  nosign = False 
)

Performs a POST of the given JSON, which should represent a resource, to the given relative path.

:param str path: The path to append to base_uri :param dict resource_json: The JSON representing the resource :param bool nosign: If set to True, the request will not be signed :throws: Exception on HTTP status >= 400 :returns: The response object

def fhirclient.server.FHIRServer.prepare (   self)

Check whether the server is ready to make calls, i.e.

is has fetched its capability statement and its auth instance is ready. This method will fetch the capability statement if it hasn't already been fetched.

:returns: True if the server can make authenticated calls

def fhirclient.server.FHIRServer.put_json (   self,
  path,
  resource_json,
  nosign = False 
)

Performs a PUT request of the given JSON, which should represent a resource, to the given relative path.

:param str path: The path to append to base_uri :param dict resource_json: The JSON representing the resource :param bool nosign: If set to True, the request will not be signed :throws: Exception on HTTP status >= 400 :returns: The response object

def fhirclient.server.FHIRServer.raise_for_status (   self,
  response 
)
def fhirclient.server.FHIRServer.ready (   self)

Check whether the server is ready to make calls, i.e.

is has fetched its capability statement and its auth instance is ready.

:returns: True if the server can make authenticated calls

def fhirclient.server.FHIRServer.reauthorize (   self)
def fhirclient.server.FHIRServer.request_data (   self,
  path,
  headers = {},
  nosign = False 
)

Perform a data request data against the server's base with the given relative path.

def fhirclient.server.FHIRServer.request_json (   self,
  path,
  nosign = False 
)

Perform a request for JSON data against the server's base with the given relative path.

:param str path: The path to append to base_uri :param bool nosign: If set to True, the request will not be signed :throws: Exception on HTTP status >= 400 :returns: Decoded JSON response

def fhirclient.server.FHIRServer.should_save_state (   self)
def fhirclient.server.FHIRServer.state (   self)

Return current state.

Member Data Documentation

fhirclient.server.FHIRServer.auth
fhirclient.server.FHIRServer.base_uri
fhirclient.server.FHIRServer.client
fhirclient.server.FHIRServer.session

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