Skip to content

Instantly share code, notes, and snippets.

@richieforeman
Last active January 8, 2016 16:31
Show Gist options
  • Select an option

  • Save richieforeman/7a1b85ca896d2e38b556 to your computer and use it in GitHub Desktop.

Select an option

Save richieforeman/7a1b85ca896d2e38b556 to your computer and use it in GitHub Desktop.

Revisions

  1. richieforeman revised this gist Jan 8, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion tracing_token_example.py
    Original file line number Diff line number Diff line change
    @@ -12,7 +12,7 @@
    #
    # Additionally, the Python library "execute" method allows for a "num_retries" param,
    # which is a baked in exponential backoff mechanism.
    service.users().makeAdmin(trace="trace:<<tracing token goes here>>",
    service.users().makeAdmin(trace="token:<<tracing token goes here>>",
    userKey=username,
    body={
    'status': True
  2. richieforeman created this gist Jul 9, 2014.
    19 changes: 19 additions & 0 deletions tracing_token_example.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    service = build(serviceName="admin",
    version="directory_v1",
    http=httplib2.Http())

    # A tracing token can be attached by utilizing the 'trace' kwarg on a method call.
    # Switching the request to utilize all 'kwargs' is recommended.
    #
    # Importantly, when a request (such as the one below) includes a body parameter,
    # the tracing token should NOT be included in the body.
    #
    # The tracing token parameter will need to be added to EACH AND EVERY call where a tracing token is required.
    #
    # Additionally, the Python library "execute" method allows for a "num_retries" param,
    # which is a baked in exponential backoff mechanism.
    service.users().makeAdmin(trace="trace:<<tracing token goes here>>",
    userKey=username,
    body={
    'status': True
    }).execute(num_retries=5)