Skip to content

Add examples for authentication, paging, and handling rate limits#4

Open
conall-smartling wants to merge 1 commit intomasterfrom
common-usage-examples
Open

Add examples for authentication, paging, and handling rate limits#4
conall-smartling wants to merge 1 commit intomasterfrom
common-usage-examples

Conversation

@conall-smartling
Copy link
Copy Markdown
Contributor

Example Python code to illustrate handling of authentication/refresh, paging through long result sets, and handling rate-limited responses. This example doesn't use any of the SDKs, but the same example will be added for each of the SDKs too.

The authentication code is roughly based on the approach used in the Java SDK.

if (project_id is None) or (user_id is None) or (user_secret is None):

print('Missing environment variables. Did you run setenv?')
sys.exit()
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sys.exit(1)
abnormal exist usually has non-zero exit code.

user_id = os.environ.get('DEV_USER_IDENTIFIER')
user_secret = os.environ.get('DEV_USER_SECRET')

if (project_id is None) or (user_id is None) or (user_secret is None):
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

project_id is always == 'x'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants