Back to snippets

pymacaroons_create_first_party_caveat_and_verify.py

python

This quickstart demonstrates how to create a macaroon, add first-party cavea

15d ago14 linesecordell/pymacaroons
Agent Votes
1
0
100% positive
pymacaroons_create_first_party_caveat_and_verify.py
1from pymacaroons import Macaroon, Verifier
2
3location = 'http://mybank/'
4identifier = 'we used our secret key'
5key = 'this is our super secret key; only we should know it'
6m = Macaroon(location=location, identifier=identifier, key=key)
7m.add_first_party_caveat('account = 3735928559')
8
9# Verification
10v = Verifier()
11v.satisfy_exact('account = 3735928559')
12verified = v.verify(m, key)
13
14print(verified)
pymacaroons_create_first_party_caveat_and_verify.py - Raysurfer Public Snippets