Update jst_ph_search.py
parent
6ab520b8b0
commit
fc0d17cbe9
|
@ -10,7 +10,7 @@ def write_to_file(searchfilename, json_data):
|
||||||
s_id_wr = DictWriter(s_id, fieldnames=column)
|
s_id_wr = DictWriter(s_id, fieldnames=column)
|
||||||
if s_id.tell() == 0:
|
if s_id.tell() == 0:
|
||||||
s_id_wr.writeheader()
|
s_id_wr.writeheader()
|
||||||
print(json_data)
|
# print(json_data)
|
||||||
# input()
|
# input()
|
||||||
writeable_data = {
|
writeable_data = {
|
||||||
"jobid" : json_data.get('id'),
|
"jobid" : json_data.get('id'),
|
||||||
|
@ -47,6 +47,7 @@ def ph_search(searchfilename):
|
||||||
}
|
}
|
||||||
|
|
||||||
while current_page<= total_pages :
|
while current_page<= total_pages :
|
||||||
|
print(f'{current_page} of {total_pages})
|
||||||
query_params = {
|
query_params = {
|
||||||
"siteKey": "PH-Main",
|
"siteKey": "PH-Main",
|
||||||
"sourcesystem": "houston",
|
"sourcesystem": "houston",
|
||||||
|
@ -68,6 +69,7 @@ def ph_search(searchfilename):
|
||||||
total_pages = ceil(response.json()['totalCount']/100)
|
total_pages = ceil(response.json()['totalCount']/100)
|
||||||
for each_job in response.json()['data']:
|
for each_job in response.json()['data']:
|
||||||
write_to_file( searchfilename, each_job)
|
write_to_file( searchfilename, each_job)
|
||||||
|
current_page +=1
|
||||||
else:
|
else:
|
||||||
print("Request failed with status code:", response.status_code)
|
print("Request failed with status code:", response.status_code)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue