fix minor stuff
This commit is contained in:
		
							parent
							
								
									daf737fa08
								
							
						
					
					
						commit
						cc3cd394a5
					
				|  | @ -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 | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue