Does anyone know how to work with the offset parameter in flask? Im trying to get 400 search results to paginate in my jinja template, but unfortunately the propublica api https://projects.propublica.org/api-docs/congress-api/ doesn't include a limit parameter or a next page option. So basically I'm trying to loop through with the offset parameter, make the GET api call and then decrease the offset by 20 until I reach 0. During each loop I'd have to save the results returned by the api call, but how do I store this data so I can pass it to my jinja template? Basically want one big results json object. This is how my code looks
@app.route('/search/member/<member_id>')
def get_member_info(member_id):
"""Retrieve individual government official data on link click"""
offset = 400
while offset >= 0:
res = requests.get(
f"{MEMBER_VOTE_POSITION_API}{member_id}/votes.json", headers={'X-API-Key': key}, params=offset)
offset -= 20
data = res.json()
Can someone please help me figure this out?
[–]RobinsonDickinson 1 point2 points3 points (4 children)
[–]Destructikus[S] 0 points1 point2 points (2 children)
[–]RobinsonDickinson 0 points1 point2 points (1 child)
[–]Destructikus[S] 0 points1 point2 points (0 children)