reluce / szurubooru-toolkit

Python package and script collection to manage your szurubooru image board.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

An error occured while getting the image token: Invalid token.

ShadaxTheWizard opened this issue · comments

I'm getting an invalid token error when trying to run upload_images.py

This is my full terminal output:

Found 1 images. Starting upload...
  0%|                                                     | 0/1 [00:00<?, ?it/s]
An error occured while getting the image token: Invalid token.

An error occured during the similarity check: Invalid token.
Traceback (most recent call last):
  File "B:\Downloads\szurubooru-scripts-main_fork\upload_images.py", line 204, in <module>
    main()
  File "B:\Downloads\szurubooru-scripts-main_fork\upload_images.py", line 184, in main
    post.exact_post, similar_posts = check_similarity(api, post.image_token)
TypeError: cannot unpack non-iterable NoneType object

I'm running szurubooru on unraid as a docker container. I generated the token by running echo -n admin:token | base64 in the dockers console.
I'm running the python scripts on a Windows machine

My full config file with personal info redacted:

{
    "szurubooru": {
        "url": "https://szurubooru.domain.com",
        "api_token": "my_token",
        "public": "False"
    },
    "auto_tagger": {
        "saucenao_api_key": "my_api_key",
        "show_progress": "True",
        "local_tmp_path": "/tmp/",
        "use_saucenao": "False",
        "deepbooru_enabled": "False",
        "deepbooru_model": "./misc/deepbooru/model-resnet_custom_v3.h5",
        "deepbooru_threshold": "0.7",
        "boorus": {
            "danbooru": {
                "user": "my_username",
                "api_key": "my_api_key"
            },
            "gelbooru": {
                "user": "None",
                "api_key": "None"
            },
            "konachan": {
                "user": "None",
                "password": "None"
            },
            "yandere": {
                "user": "None",
                "password": "None"
            },
            "pixiv": {
                "user": "None",
                "password": "None",
                "token": "None"
            }
        }
    },
    "upload_images": {
        "upload_dir": "P:/phone/szurubooru",
        "show_progress": "True",
        "tags": ["auto_tagme"]
    }
}

Hey, you have to generate a login token for the user first.
You can do that under Account > Login tokens > Create token.

Then you replace token in the command with the generated token.
I'll update the Readme to make this more clear.

Let me know if it works for you.

Then you replace token in the command with the generated token.

I knew I must've been missing something. This now works flawlessly! Thanks!