Skip to content

Instantly share code, notes, and snippets.

@ashwch
Last active April 2, 2025 04:05
Show Gist options
  • Select an option

  • Save ashwch/1fc98f3f76860b95936bf278ba38dbba to your computer and use it in GitHub Desktop.

Select an option

Save ashwch/1fc98f3f76860b95936bf278ba38dbba to your computer and use it in GitHub Desktop.
pg_history_demo_1.py
import pghistory
with pghistory.context(url="/foo/bar", user="bugs-bunny") as pg:
print(f"Level 1-1: {pg.metadata}")
with pghistory.context(foo="bar"):
print(f"Level 2-1: {pg.metadata}")
with pghistory.context(spam="eggs"):
print(f"Level 3-1: {pg.metadata}")
with pghistory.context(hannah="montana"):
print(f"Level 3-2: {pg.metadata}")
with pghistory.context(timon="pumba"):
print(f"Level 4-1: {pg.metadata}")
print(f"Level 1-2: {pg.metadata}")
with pghistory.context(monty="python"):
print(f"Level 2-2: {pg.metadata}")
with pghistory.context(guido="bdfl") as pg_2:
print(f"Level 1-4: {pg_2.metadata}")
print(f"Level 1-5: {pg.metadata}")
print(f"Level 1-6: {pg_2.metadata}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment