This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import string | |
import yaml | |
def load_yaml(f, context=None): | |
if context is None: | |
context = {} | |
def string_constructor(loader, node): | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import json | |
import requests | |
_PUBLIC_SECRET = os.environ['KLAVIYO_PUBLIC_SECRET'] | |
_API_ROOT = 'https://a.klaviyo.com/api' | |
_VALID_EXTRA_ATTRIBUTES = [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# MIT LICENSE | |
# | |
# Copyright 2023 Dustin Oprea | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the “Software”), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import yaml | |
def load_and_assert_uniqueness(x): | |
# We'd like to detect duplicates. Since PyYAML both loads things depth-first | |
# *and* doesn't give us the parent when processing a child node, we'll index | |
# of all of the object IDs as we're constructing them, and then see which | |
# are disappeared from the final hierarchy. Since all we can do is pass a | |
# class, we need to inline the class in order to load into an index within | |
# our scope. |
OlderNewer