Commit e5ab07670e
Unsigned
Layout: unified · split
curd.py +15
| @@ -37,6 +37,10 @@ def write_to_tmp(tmp_filename:str, content:str): | ||
| 37 | 37 | with open(f"scripts/tmp/{tmp_filename}", "w") as _: |
| 38 | 38 | _.write(content) |
| 39 | 39 | return True |
| 40 | except FileNotFoundError: | |
| 41 | with open(f"./scripts/tmp/tmp_filename", "w") as _: | |
| 42 | _.write(content) | |
| 43 | return True | |
| 40 | 44 | except: |
| 41 | 45 | return False |
| 42 | 46 | |
| @@ -45,6 +49,10 @@ def read_tmp(tmp_filename:str): | ||
| 45 | 49 | with open(f"scripts/tmp/{tmp_filename}", "r") as _: |
| 46 | 50 | content = _.read() |
| 47 | 51 | return content |
| 52 | except FileNotFoundError: | |
| 53 | with open(f"./scripts/tmp/tmp_filename", "w") as _: | |
| 54 | _.write("") | |
| 55 | return "" | |
| 48 | 56 | except: |
| 49 | 57 | return False |
| 50 | 58 | |
| @@ -159,6 +167,13 @@ def load_config() -> dict: | ||
| 159 | 167 | # return config_file.read() |
| 160 | 168 | |
| 161 | 169 | # START OF SCRIPT |
| 170 | ||
| 171 | if not os.path.exists("./scripts/tmp/"): | |
| 172 | try: | |
| 173 | os.makedirs(os.path.dirname("./scripts/tmp/")) | |
| 174 | except: | |
| 175 | pass | |
| 176 | ||
| 162 | 177 | access_token = os.environ.get('ANILIST_ACCESS_TOKEN') |
| 163 | 178 | |
| 164 | 179 | parser = argparse.ArgumentParser(description="Print a greeting message.") |