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

Document usage of the SDK against Preview #237

Open
sirosen opened this issue Oct 19, 2017 · 3 comments
Open

Document usage of the SDK against Preview #237

sirosen opened this issue Oct 19, 2017 · 3 comments
Labels
docs New or updated documentation good first issue A good issue for first-time contributors

Comments

@sirosen
Copy link
Member

sirosen commented Oct 19, 2017

This runs much deeper than #236.
We need to document usage, including, but not limited to:

  • Preview client registration
  • Preview identities/endpoints/entities being distinct from their Production counterparts, and the absence of any magic or automatic mirroring
  • Setting up recommended patterns for doing environment dispatch to get at Preview (i.e. you might want a single codebase, but multiple client IDs wrapped in an env var check)
@sirosen sirosen added the docs New or updated documentation label Oct 19, 2017
@ajsierakowski
Copy link

Any chance you can provide a quick and dirty intro on how to force globus-sdk-python to use the preview environment? I've just realized that I'm having trouble testing the preview environment because the sdk keeps using the production auth api.

Thanks!

@sirosen
Copy link
Member Author

sirosen commented Nov 28, 2017

@ajsierakowski for right now, you can do the following:

  • register your client at auth.preview.globus.org/developers and make it as similar to your production client as possible
  • set the GLOBUS_SDK_ENVIRONMENT=preview environment variable before running SDK code

That environment variable will tell the SDK to use the Preview Auth and Transfer APIs.

If you're having trouble, I'd also recommend:

  • check that you're using the Client ID for your Preview client
  • try turning on debug logging for the SDK (more on this below)

For debug logging, you need to use python logging. As a simple example,

import logging
l = logging.getLogger('globus_sdk')
l.setLevel(logging.DEBUG)
l.addHandler(logging.StreamHandler())

Fair warning: we've made SDK debug logging really chatty, but it includes details like

Request made to URL: https://transfer.api.preview.globus.org/v0.10/delete

which can be helpful when troubleshooting.

Something which I've found helpful in the past, and you may too, is to actually have your client code detect GLOBUS_SDK_ENVIRONMENT like so:

client_id = 'production_client_id'
if os.environ.get('GLOBUS_SDK_ENVIRONMENT') == 'preview':
    client_id = 'preview_client_id'
native_auth_client = NativeAppAuthClient(client_id)

Hope this all helps (and helps us write docs on this topic).

@ajsierakowski
Copy link

Thanks for the clear description. The environment variable was precisely what I needed.

@sirosen sirosen added the good first issue A good issue for first-time contributors label Dec 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs New or updated documentation good first issue A good issue for first-time contributors
Projects
None yet
Development

No branches or pull requests

2 participants