Fetch all events for an issue like this issue = "12345678" events = get_all_issue_events(issue) First set your SENTRY_AUTH_TOKEN as env var With definitions.. import requests import time def get_all_issue_events(organization_slug, project_slug, issue_id): url = 'https://app.getsentry.com/api/0/issues/%s/events/' % issue_id all_data = get_all_data(url) event_ids = [x["id"] for x in all_data] detail_vec = [get_event_data(organization_slug, project_slug, event_id) for event_id in event_ids] return all_data, detail_vec def get_all_data(url): token = os.environ.get('SENTRY_AUTH_TOKEN') headers = {"Authorization": "Bearer %s" % token, 'Content-Type': 'application/json'} next_results = 'true' next_url = url all_data = [] while next_results == 'true': # Do fetch pass response = requests....
Handies
enter and exit According to stack overflow you can.. In [97]: class Blah(object): ...: def __enter__(self): ...: print("hello") ...: return self ...: def __exit__(self, exc_type, exc_val, exc_tb): ...: print("bye!") ...: my = "stuff" ...: In [98]: with Blah(): ...: print("doing stuff") ...: hello doing stuff bye! The specific example that follows this is the object which is returned by import psycopg2 conn = psycopg2.connect() Help on connection object: class connection(builtins.object) | connection(dsn, ....
Glom does not let you write or at least I couldnt figure out how. Tinkering with a spec based writer… from glom import glom, PathAccessError def nested_assign(target, spec, value): parts = spec.split(".") last = parts[-1] while parts[:-1]: top = parts.pop(0) target = target[top] target[last] = value def _plant(target, spec): """This is the equivalent of mkdir -p blah/flarg/blarg/klarf """ parts = spec.split(".") try: for i, part in enumerate(parts): glom(target, ".".join(parts[:i + 1])) except PathAccessError as e: print(repr(e)) print("stopped at ", i, part) print("going to add remaining", parts[i:]) print("....
for tar.gz Assuming we have a func read_from_s3 that reads from s3… import tarfile targz = read_from_s3(bucket, s3fn) tar = tarfile.open(fileobj=io.BytesIO(targz), mode="r:gz") blahstream = tar.extractfile('blah-filename') for zip files Nice doc here from zipfile import ZipFile with ZipFile('foo.zip') as zip_archive: foo = zip_archive.read('some/file.txt')
Macvim brew install macvim Then cp -R /usr/local/Cellar/macvim/8.2-171_1/MacVim.app ~/Applications And add alias mvim=/Users/${username}/Applications/MacVim.app/Contents/bin/mvim to ~/.bash_profile If above not possible, then download MacVIM from macvim github ( which was forked from here originally I think ) other vim stuff ctrlp, from https://github.com/ctrlpvim/ctrlp.vim mkdir -p ~/.vim/pack/plugins/start git clone --depth=1 https://github.com/ctrlpvim/ctrlp.vim.git ~/.vim/pack/plugins/start/ctrlp theme, solarized8 sometimes is good (also slate too ) mkdir -p ~/.vim/pack/themes/opt/ cd ~/.vim/pack/themes/opt/ git clone git@github.com:lifepillar/vim-solarized8.git Vim notes Vim doesnt know about “terraform” files like ....