SMART on FHIR Python Client 4.2.0
 
Loading...
Searching...
No Matches
fhirclient.client.FHIRClient Class Reference

Instances of this class handle authorizing and talking to SMART on FHIR servers. More...

Public Member Functions

 __init__ (self, settings=None, state=None, save_func=lambda x:x)
 
 prepare (self)
 Returns True if the client is ready to make API calls (e.g.
 
 handle_callback (self, url)
 You can call this to have the client automatically handle the auth callback after the user has logged in.
 
 authorize (self)
 Try to authorize with the server.
 
 reauthorize (self)
 Try to reauthorize with the server.
 
 human_name (self, human_name_instance)
 Formats a HumanName instance into a string.
 
 reset_patient (self)
 
 from_state (self, state)
 
 save_state (self)
 

Public Attributes

 app_id
 
 app_secret
 
 server
 
 scope
 
 redirect
 
 launch_token
 
 launch_context
 
 wants_patient
 
 patient_id
 
 jwt_token
 

Protected Member Functions

 _handle_launch_context (self, ctx)
 

Protected Attributes

 _patient
 
 _save_func
 

Properties

 desired_scope = property
 Ensures self.scope is completed with launch scopes, according to current client settings.
 
 ready = property
 Returns True if the client is ready to make API calls (e.g.
 
 authorize_url = property
 The URL to use to receive an authorization token.
 
 patient = property
 
 state = property
 

Detailed Description

Instances of this class handle authorizing and talking to SMART on FHIR servers.

The settings dictionary supports:

- `app_id`*: Your app/client-id, e.g. 'my_web_app'
- `app_secret`*: Your app/client-secret
- `api_base`*: The FHIR service to connect to, e.g. 'https://fhir-api-dstu2.smarthealthit.org'
- `redirect_uri`: The callback/redirect URL for your app, e.g. 'http://localhost:8000/fhir-app/' when testing locally
- `patient_id`: The patient id against which to operate, if already known
- `scope`: Space-separated list of scopes to request, if other than default
- `launch_token`: The launch token

Constructor & Destructor Documentation

◆ __init__()

fhirclient.client.FHIRClient.__init__ (   self,
  settings = None,
  state = None,
  save_func = lambda x:x 
)

Member Function Documentation

◆ _handle_launch_context()

fhirclient.client.FHIRClient._handle_launch_context (   self,
  ctx 
)
protected

◆ authorize()

fhirclient.client.FHIRClient.authorize (   self)

Try to authorize with the server.

◆ from_state()

fhirclient.client.FHIRClient.from_state (   self,
  state 
)

◆ handle_callback()

fhirclient.client.FHIRClient.handle_callback (   self,
  url 
)

You can call this to have the client automatically handle the auth callback after the user has logged in.

Parameters
urlstr The complete callback URL

◆ human_name()

fhirclient.client.FHIRClient.human_name (   self,
  human_name_instance 
)

Formats a HumanName instance into a string.

◆ prepare()

fhirclient.client.FHIRClient.prepare (   self)

Returns True if the client is ready to make API calls (e.g.

there is an access token or this is an open server). In contrast to the ready property, this method will fetch the server's capability statement if it hasn't yet been fetched.

Returns
s True if the server can make authenticated calls

◆ reauthorize()

fhirclient.client.FHIRClient.reauthorize (   self)

Try to reauthorize with the server.

Returns
s A bool indicating reauthorization success

◆ reset_patient()

fhirclient.client.FHIRClient.reset_patient (   self)

◆ save_state()

fhirclient.client.FHIRClient.save_state (   self)

Member Data Documentation

◆ _patient

fhirclient.client.FHIRClient._patient
protected

◆ _save_func

fhirclient.client.FHIRClient._save_func
protected

◆ app_id

fhirclient.client.FHIRClient.app_id

◆ app_secret

fhirclient.client.FHIRClient.app_secret

◆ jwt_token

fhirclient.client.FHIRClient.jwt_token

◆ launch_context

fhirclient.client.FHIRClient.launch_context

◆ launch_token

fhirclient.client.FHIRClient.launch_token

◆ patient_id

fhirclient.client.FHIRClient.patient_id

◆ redirect

fhirclient.client.FHIRClient.redirect

◆ scope

fhirclient.client.FHIRClient.scope

◆ server

fhirclient.client.FHIRClient.server

◆ wants_patient

fhirclient.client.FHIRClient.wants_patient

Property Documentation

◆ authorize_url

fhirclient.client.FHIRClient.authorize_url = property
static

The URL to use to receive an authorization token.

◆ desired_scope

fhirclient.client.FHIRClient.desired_scope = property
static

Ensures self.scope is completed with launch scopes, according to current client settings.

◆ patient

fhirclient.client.FHIRClient.patient = property
static

◆ ready

fhirclient.client.FHIRClient.ready = property
static

Returns True if the client is ready to make API calls (e.g.

there is an access token or this is an open server).

Returns
s True if the server can make authenticated calls

◆ state

fhirclient.client.FHIRClient.state = property
static

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