Revision 1691
Added by Aaron Marcuse-Kubitza over 12 years ago
bin/digir_client | ||
---|---|---|
80 | 80 |
# Logging |
81 | 81 |
def clear_line(): sys.stderr.write('\n') |
82 | 82 |
log_indent = 0 |
83 |
def log(msg, line_ending='\n'): |
|
84 |
sys.stderr.write((' '*log_indent)+msg+line_ending) |
|
83 |
def log(msg, line_ending='\n'): sys.stderr.write(msg+line_ending) |
|
85 | 84 |
def debug_log(str_, label=None): |
86 | 85 |
if debug: |
87 | 86 |
if label != None: sys.stderr.write(label+':\n') |
... | ... | |
95 | 94 |
.replace('[url]', url) |
96 | 95 |
.replace('[resource]', resource) |
97 | 96 |
.replace('[schema]', schema) |
98 |
.replace('[count]', str(chunk_size)) |
|
99 | 97 |
) |
100 | 98 |
|
101 | 99 |
# Stats |
... | ... | |
106 | 104 |
|
107 | 105 |
# Retrieve data |
108 | 106 |
while count == None or total < count: |
107 |
# Adjust chunk size if last chunk |
|
108 |
remaining_ct = count - total |
|
109 |
this_chunk_size = min(chunk_size, remaining_ct) |
|
110 |
|
|
109 | 111 |
# Request XML |
110 | 112 |
time = dates.strftime('%Y-%m-%d %H:%M:%S %Z', dates.now()) |
111 | 113 |
request_xml = (this_request_xml_template |
114 |
.replace('[count]', str(this_chunk_size)) |
|
112 | 115 |
.replace('[start]', str(start)) |
113 | 116 |
.replace('[time]', time) |
114 | 117 |
) |
Also available in: Unified diff
digir_client: Fixed bug where chunk_size records would always be retrieved even in the last chunk, which ignored any manual count the user might have set via the "n" option