SMART on FHIR Python Client 4.2.0
 
Loading...
Searching...
No Matches
fhirclient.server.FHIRServer Class Reference

Handles talking to a FHIR server. More...

Public Member Functions

 __init__ (self, client, base_uri=None, state=None)
 
 should_save_state (self)
 
 get_capability (self, force=False)
 Returns the server's CapabilityStatement, retrieving it if needed or forced.
 
 handle_callback (self, url)
 
 authorize (self)
 
 reauthorize (self)
 
 prepare (self)
 Check whether the server is ready to make calls, i.e.
 
 request_json (self, path, nosign=False)
 Perform a request for JSON data against the server's base with the given relative path.
 
 request_data (self, path, headers={}, nosign=False)
 Perform a data request data against the server's base with the given relative path.
 
 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.
 
 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.
 
 post_as_form (self, url, formdata, auth=None)
 Performs a POST request with form-data, expecting to receive JSON.
 
 delete_json (self, path, nosign=False)
 Issues a DELETE command against the given relative path, accepting a JSON response.
 
 raise_for_status (self, response)
 
 from_state (self, state)
 Update ivars from given state information.
 

Public Attributes

 client
 
 auth
 
 base_uri
 
 aud
 
 session
 

Protected Member Functions

 _get (self, path, headers={}, nosign=False)
 Issues a GET request.
 

Protected Attributes

 _capability
 

Properties

 capabilityStatement = property
 
 desired_scope = property
 
 launch_token = property
 
 authorize_uri = property
 
 ready = property
 Check whether the server is ready to make calls, i.e.
 
 state = property
 Return current state.
 

Detailed Description

Handles talking to a FHIR server.

Constructor & Destructor Documentation

◆ __init__()

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

Member Function Documentation

◆ _get()

fhirclient.server.FHIRServer._get (   self,
  path,
  headers = {},
  nosign = False 
)
protected

Issues a GET request.

Returns
s The response object

◆ authorize()

fhirclient.server.FHIRServer.authorize (   self)

◆ delete_json()

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

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

Parameters
pathstr The relative URL path to issue a DELETE against
nosignbool If set to True, the request will not be signed
Returns
s The response object

◆ from_state()

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

Update ivars from given state information.

◆ get_capability()

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

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

◆ handle_callback()

fhirclient.server.FHIRServer.handle_callback (   self,
  url 
)

◆ post_as_form()

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
s The response object

◆ post_json()

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.

Parameters
pathstr The path to append to base_uri
resource_jsondict The JSON representing the resource
nosignbool If set to True, the request will not be signed :throws: Exception on HTTP status >= 400
Returns
s The response object

◆ prepare()

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
s True if the server can make authenticated calls

◆ put_json()

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.

Parameters
pathstr The path to append to base_uri
resource_jsondict The JSON representing the resource
nosignbool If set to True, the request will not be signed :throws: Exception on HTTP status >= 400
Returns
s The response object

◆ raise_for_status()

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

◆ reauthorize()

fhirclient.server.FHIRServer.reauthorize (   self)

◆ request_data()

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.

◆ request_json()

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.

Parameters
pathstr The path to append to base_uri
nosignbool If set to True, the request will not be signed :throws: Exception on HTTP status >= 400
Returns
s Decoded JSON response

◆ should_save_state()

fhirclient.server.FHIRServer.should_save_state (   self)

Member Data Documentation

◆ _capability

fhirclient.server.FHIRServer._capability
protected

◆ aud

fhirclient.server.FHIRServer.aud

◆ auth

fhirclient.server.FHIRServer.auth

◆ base_uri

fhirclient.server.FHIRServer.base_uri

◆ client

fhirclient.server.FHIRServer.client

◆ session

fhirclient.server.FHIRServer.session

Property Documentation

◆ authorize_uri

fhirclient.server.FHIRServer.authorize_uri = property
static

◆ capabilityStatement

fhirclient.server.FHIRServer.capabilityStatement = property
static

◆ desired_scope

fhirclient.server.FHIRServer.desired_scope = property
static

◆ launch_token

fhirclient.server.FHIRServer.launch_token = property
static

◆ ready

fhirclient.server.FHIRServer.ready = property
static

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

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

Returns
s True if the server can make authenticated calls

◆ state

fhirclient.server.FHIRServer.state = property
static

Return current state.


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