Hello, I need help with my Python code where I am retrieving element information from all boards specified in a table named: df_boards_norm. But i run into a problem that in some boards there are more then 500 items (and i have a limit of 500, I cant change this part), and the cursor then is not null. I need somehow to check if the cursor is not null to run the code again with the same board id where it left of, but if it comes on null, run other boards like normal.
Thie is my part of the code:
pulse_1 = pd.DataFrame()
for i in range(len(df_boards_norm)):
q_pulses = (
"{boards(ids:"
+ df_boards_norm.loc[i, "id"]
+ "){items_page (limit:500){cursor items{id name column_values (types: time_tracking){value}}}}}"
)
data_pulses = {"query": q_pulses}
r_pulses = requests.post(url=apiUrl, json=data_pulses, headers=headers)
pulses_json = r_pulses.json()
df_pulses_norm = pd.json_normalize(
pulses_json['data']['boards'][0]['items_page'],
record_path=['items', 'column_values'],
meta=[
['items', 'id'],
['items', 'name'],
],
errors="ignore",
)
df_pulses_norm.insert(0, "board_id", df_boards_norm.loc[i, "id"])
pulse_1 = pd.concat([pulse_1, df_pulses_norm], ignore_index=True)
pulse_1['value'] = pulse_1['value'].apply(lambda x: {} if pd.isna(x) else x)
pulse_1 = pulse_1[pulse_1['value'] != {}].reset_index()
pulse_1.head()
Also, is there a possibility to add more: so it will take more columns from monday. Something like this:
{cursor items{id updated_at name column_values (types: time_tracking){value … on TimeTrackingValue
{
running
started_at
updated_at
history
{
started_at
ended_at
started_user_id
ended_user_id
}
}
}}}}}
I just do not know how to incorporate these two things into my code. I will be really pleased if someone will help me, because in this part right now I feel helpless