def delete(self, username, program_id): collection = DB.find_one("programs", { "program_id": program_id, "username": username }) # Abort if collection not found if not collection: api.abort(404, "There are no collections in the database") DB.delete_one("programs", {"program_id": program_id}) return {}, 200
with open('usernames.txt') as f: username_list = f.readlines() for acc in username_list: acc = acc.strip() ig_uni_key = IG_PROFILE + acc mydb.refinstagram_col() filter = {'InsPageLink': ig_uni_key} status = mydb.find_one(filter) try: if status['Check'] == True: print('Passed.') bar() continue except KeyError: pass except TypeError: pass print(acc) result = get_data(mydb, acc) if result: mydb.refinstagram_col() if status: mydb.delete_one(status) mydb.insert_one(result) bar()