From 7c73ddaed7f74a7543c8c18c57ddf40861f023ad Mon Sep 17 00:00:00 2001 From: MickSlash Date: Wed, 14 Dec 2022 22:41:34 +0000 Subject: [PATCH] #Refactor Code --- onedriveLinks.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/onedriveLinks.py b/onedriveLinks.py index 43b10bc..b79eb5c 100644 --- a/onedriveLinks.py +++ b/onedriveLinks.py @@ -72,7 +72,7 @@ def apiOneDrive(folderType=None,nameFile=None): if r.status_code == 200: r = r.json() data = r["folder"]["value"] - if r["next"]: + if "next" in r: while "next" in r: nextLink = r["next"] r = session.get(f"{apiURL}&next={nextLink}").json() @@ -100,8 +100,4 @@ def fileFinderDB(nameFile, rawURL, data, counter): def writeToText(text): with open('link_modificati.txt', 'a', encoding='utf-8') as f: - f.write(f"{text}\n") - - - -apiOneDrive("MLIF/") \ No newline at end of file + f.write(f"{text}\n") \ No newline at end of file