diff options
| author | Mirek Kratochvil <exa.exa@gmail.com> | 2025-10-13 21:40:44 +0200 |
|---|---|---|
| committer | Mirek Kratochvil <exa.exa@gmail.com> | 2025-10-13 21:40:44 +0200 |
| commit | cc3cd394a56b361d039825a89faaebf184f24d05 (patch) | |
| tree | c9e04016078b5d25053ca9b73fb49b3b516c7aa2 | |
| parent | daf737fa08a1478cebc5a48f871d81f33a73ebf4 (diff) | |
| download | patchodon-cc3cd394a56b361d039825a89faaebf184f24d05.tar.gz patchodon-cc3cd394a56b361d039825a89faaebf184f24d05.tar.bz2 | |
fix minor stuff
| -rw-r--r-- | src/patchodon/__init__.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/patchodon/__init__.py b/src/patchodon/__init__.py index db21732..ff96d6d 100644 --- a/src/patchodon/__init__.py +++ b/src/patchodon/__init__.py @@ -162,7 +162,7 @@ def do_post(args): files = args.patchfile if not files: trace("reading patchfile series from stdin") - files = mapl(lambda x: x.rstrip(chars="\n"), sys.stdin.readlines()) + files = mapl(lambda x: x.rstrip("\n"), sys.stdin.readlines()) n_patches = len(files) hashes = mapl( lambda x: hashlib.sha1(Path(x).read_text().encode()).hexdigest(), files @@ -254,7 +254,9 @@ def parse_matching_status(args, st, parent, account, n, total_n, short_hash): """ if st["in_reply_to_id"] != parent: - trace(f"wrong reply in status {st['id']}") + # Descendants are also transitive, which includes all subsequent + # patches. Thus we just don't trace anything here to avoid excessive + # warnings. return None if st["account"]["id"] != account: trace(f"bad account in status {st['id']}") @@ -272,7 +274,12 @@ def parse_matching_status(args, st, parent, account, n, total_n, short_hash): trace(f"patch hash mismatch in status {st['id']}") return None url = gs[3] - r = requests.get(url, timeout=args.timeout) + r = requests.get( + url, + timeout=args.timeout, + headers={"User-agent": f"patchodon v{__version__}"}, + ) + time.sleep(1.1) # dpaste ToS! if r.status_code != 200: trace(f"could not get patch from status {st['id']} via {url}") return None |
