Revision 1695
Added by Aaron Marcuse-Kubitza over 12 years ago
digir_client | ||
---|---|---|
106 | 106 |
# Retrieve data |
107 | 107 |
while count == None or total < count: |
108 | 108 |
# Adjust chunk size if last chunk |
109 |
remaining_ct = count - total
|
|
110 |
this_chunk_size = min(chunk_size, remaining_ct)
|
|
109 |
this_count = chunk_size
|
|
110 |
if count != None: this_count = min(this_count, count - total)
|
|
111 | 111 |
|
112 | 112 |
# Request XML |
113 | 113 |
time = dates.strftime('%Y-%m-%d %H:%M:%S %Z', dates.now()) |
114 | 114 |
request_xml = (this_request_xml_template |
115 |
.replace('[count]', str(this_chunk_size))
|
|
115 |
.replace('[count]', str(this_count))
|
|
116 | 116 |
.replace('[start]', str(start)) |
117 | 117 |
.replace('[time]', time) |
118 | 118 |
) |
... | ... | |
149 | 149 |
total += this_ct |
150 | 150 |
start += this_ct # advance start to fetch next set |
151 | 151 |
print_status('\r') # CR at end so next print overwrites msg |
152 |
|
|
153 |
# Decide if done |
|
152 | 154 |
if this_ct == 0 or get_diag('END_OF_RECORDS') == 'true': break |
153 | 155 |
|
154 | 156 |
print_status() |
Also available in: Unified diff
digir_client: Fixed bug where chunk size was being adjusted even if count == None (indicating no determinable last chunk), causing a type mismatch between None and the integer total