Skip to content

Commit

Permalink
fix EH auth sample by replacing lambda with callback (#16207)
Browse files Browse the repository at this point in the history
  • Loading branch information
swathipil authored Jan 20, 2021
1 parent c481022 commit 90fbe72
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ def generate_sas_token(uri, sas_name, sas_value, token_ttl):
signature = url_parse_quote(base64.b64encode(signed_hmac_sha256.digest()))
return 'SharedAccessSignature sr={}&sig={}&se={}&skn={}'.format(uri, signature, expiry, sas_name)

def on_event(context, event):
print(context.partition_id, ":", event)


class CustomizedSASCredential(object):
def __init__(self, token, expiry):
Expand Down Expand Up @@ -77,6 +80,6 @@ def get_token(self, *scopes, **kwargs):

with consumer_client:
consumer_client.receive(
lambda pc, event: print(pc.partition_id, ":", event),
on_event,
starting_position=-1
)

0 comments on commit 90fbe72

Please sign in to comment.