Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def get_rss_list():
- final_json = []
- req = requests.get(API_URL + "/limit/1", headers=API_HEADERS)
- res = req.json()
- total_of_results = res["result"]["total_of_results"]
- pages = int(math.ceil(total_of_results / API_LIM))
- for x in range(pages):
- if x == 0:
- req = requests.get(API_URL, headers=API_HEADERS)
- else:
- req = requests.get(API_URL + "/limit/" + str(API_LIM) + "/skip/" + str(x * API_LIM), headers=API_HEADERS)
- for y in req.json()["result"]["data"]:
- if len(y["rss"][0]) > 0:
- for l in y["rss"]:
- temp = {
- "source_id": y["_id"],
- "rss": l
- }
- final_json.append(temp)
- return final_json
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement