Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken example on readme #38

Closed
KBlansit opened this issue May 14, 2017 · 6 comments
Closed

Broken example on readme #38

KBlansit opened this issue May 14, 2017 · 6 comments
Labels

Comments

@KBlansit
Copy link

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.

screenshot

Is the dstu-2 site not available?

@p2
Copy link
Member

p2 commented May 14, 2017

The DSTU-2 sandbox is now here: https://sb-fhir-dstu2.smarthealthit.org/api/smartdstu2/open/

@p2 p2 closed this as completed May 14, 2017
@p2 p2 reopened this May 14, 2017
@p2 p2 added the bug label May 14, 2017
@kwiersma
Copy link

kwiersma commented Jan 4, 2018

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) ?

@z3ugma
Copy link

z3ugma commented Feb 12, 2019

What's a proper value for api_base ?

https://sb-fhir-stu3.smarthealthit.org/smartstu3/data is not responding.

@z3ugma
Copy link

z3ugma commented Feb 24, 2019

@p2 do you know where we can find an updated value for api_base?

@p2-apple
Copy link

Here are some public test servers you can use:
http://wiki.hl7.org/index.php?title=Publicly_Available_FHIR_Servers_for_testing

@mikix
Copy link
Contributor

mikix commented Jul 16, 2024

Fixed by #83

@mikix mikix closed this as completed Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants