PyJSONProxy

simple proxy and scraper
git clone https://git.ce9e.org/PyJSONProxy.git

commit
2c233051342c4420a14ba7d0c583ec56b0756577
parent
9b700e8b4ef1200d842df83e04b69d38b4e33f3d
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2019-02-23 09:36
Gardening

Diffstat

M jsonproxy/lib.py 9 +++++----

1 files changed, 5 insertions, 4 deletions


diff --git a/jsonproxy/lib.py b/jsonproxy/lib.py

@@ -30,9 +30,9 @@ def iter_attribute(html, selector):
   30    30 
   31    31 
   32    32 def get_attribute(html, selector):
   33    -1 	l = iter_attribute(html, selector)
   -1    33 	iterator = iter_attribute(html, selector)
   34    34 	try:
   35    -1 		return next(l)
   -1    35 		return next(iterator)
   36    36 	except StopIteration:
   37    37 		if not selector.endswith('?'):
   38    38 			raise
@@ -90,8 +90,9 @@ def check_fields_config(fields, endpoint, field=''):
   90    90 		full_key = field + '.' + key if field else key
   91    91 		if isinstance(value, dict):
   92    92 			if 'selector' not in value:
   93    -1 				yield ('No selector configured for field %s in endpoint %s.' %
   94    -1 					(full_key, endpoint))
   -1    93 				yield ('No selector configured for field %s in endpoint %s.' % (
   -1    94 					full_key, endpoint
   -1    95 				))
   95    96 			if 'fields' in value:
   96    97 				for error in check_fields_config(value['fields'], endpoint, full_key):
   97    98 					yield error