client-py
client-py copied to clipboard
Broken example on readme
I was trying to go through the read me instructions, but I got an error after passing the first information.
`from fhirclient import client settings = { 'app_id': 'my_web_app', 'api_base': 'https://fhir-open-api-dstu2.smarthealthit.org' } smart = client.FHIRClient(settings=settings)
import fhirclient.models.patient as p patient = p.Patient.read('hca-pat-1', smart.server) ` I received the following error.

Is the dstu-2 site not available?
The DSTU-2 sandbox is now here: https://sb-fhir-dstu2.smarthealthit.org/api/smartdstu2/open/
I put 'https://sb-fhir-dstu2.smarthealthit.org/api/smartdstu2/open/' into 'api_base' as well as trying what I think my local sandbox base is 'http://localhost:9071/api/smartdstu2/open' but I get the following error:
Traceback (most recent call last):
File "/Users/kurtwiersma/.virtualenvs/fhir-client-flask/lib/python3.6/site-packages/flask/app.py", line 1836, in __call__
return self.wsgi_app(environ, start_response)
File "/Users/kurtwiersma/.virtualenvs/fhir-client-flask/lib/python3.6/site-packages/beaker/middleware.py", line 155, in __call__
return self.wrap_app(environ, session_start_response)
File "/Users/kurtwiersma/.virtualenvs/fhir-client-flask/lib/python3.6/site-packages/flask/app.py", line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/Users/kurtwiersma/.virtualenvs/fhir-client-flask/lib/python3.6/site-packages/flask/app.py", line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "/Users/kurtwiersma/.virtualenvs/fhir-client-flask/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise
raise value
File "/Users/kurtwiersma/.virtualenvs/fhir-client-flask/lib/python3.6/site-packages/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/Users/kurtwiersma/.virtualenvs/fhir-client-flask/lib/python3.6/site-packages/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/Users/kurtwiersma/.virtualenvs/fhir-client-flask/lib/python3.6/site-packages/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/Users/kurtwiersma/.virtualenvs/fhir-client-flask/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise
raise value
File "/Users/kurtwiersma/.virtualenvs/fhir-client-flask/lib/python3.6/site-packages/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/Users/kurtwiersma/.virtualenvs/fhir-client-flask/lib/python3.6/site-packages/flask/app.py", line 1461, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/Users/kurtwiersma/Projects/pyro/client-py/flask_app.py", line 75, in index
auth_url = smart.authorize_url
File "/Users/kurtwiersma/Projects/pyro/client-py/fhirclient/client.py", line 124, in authorize_url
return self.server.authorize_uri if self.server is not None else None
File "/Users/kurtwiersma/Projects/pyro/client-py/fhirclient/server.py", line 114, in authorize_uri
self.get_capability()
File "/Users/kurtwiersma/Projects/pyro/client-py/fhirclient/server.py", line 82, in get_capability
conf = capabilitystatement.CapabilityStatement.read_from('metadata', self)
File "/Users/kurtwiersma/Projects/pyro/client-py/fhirclient/models/fhirabstractresource.py", line 103, in read_from
instance = cls(jsondict=ret)
File "/Users/kurtwiersma/Projects/pyro/client-py/fhirclient/models/capabilitystatement.py", line 137, in __init__
super(CapabilityStatement, self).__init__(jsondict=jsondict, strict=strict)
File "/Users/kurtwiersma/Projects/pyro/client-py/fhirclient/models/domainresource.py", line 42, in __init__
super(DomainResource, self).__init__(jsondict=jsondict, strict=strict)
File "/Users/kurtwiersma/Projects/pyro/client-py/fhirclient/models/resource.py", line 42, in __init__
super(Resource, self).__init__(jsondict=jsondict, strict=strict)
File "/Users/kurtwiersma/Projects/pyro/client-py/fhirclient/models/fhirabstractresource.py", line 23, in __init__
.format(self.__class__, jsondict['resourceType']))
Exception: Attempting to instantiate <class 'models.capabilitystatement.CapabilityStatement'> with resource data that defines a resourceType of "Conformance
Is there a different 'api_base' value I should using? Do you know what the value should be for a local sandbox (via https://github.com/smart-on-fhir/installer) ?
What's a proper value for api_base ?
https://sb-fhir-stu3.smarthealthit.org/smartstu3/data is not responding.
@p2 do you know where we can find an updated value for api_base?
Here are some public test servers you can use: http://wiki.hl7.org/index.php?title=Publicly_Available_FHIR_Servers_for_testing