midjourney-api-the-next-leg / python-midjourney-api

Python package for working with Midjourney via The Next Leg
MIT License
31 stars 2 forks source link

json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) #1

Open edwgjj opened 1 year ago

edwgjj commented 1 year ago

Thanks for writing this cool API. Sadly I am having an issue with it. When running this code:

from midjourney_api import TNL tnl = TNL('myapikey') response = tnl.imagine("a monkey") print(response)

I get the following error message `Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/requests/models.py", line 971, in json return complexjson.loads(self.text, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/init.py", line 346, in loads return _default_decoder.decode(s) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/ak/Library/Application Support/CodeRunner/Unsaved/Untitled.py", line 7, in tnl.get_settings() File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/midjourney_api/init.py", line 135, in get_settings return res.json() ^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/requests/models.py", line 975, in json raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)`

Any help would be appreciated to getting this to work! Thanks!

Haris-Dilawar commented 1 year ago

same issue

meriem-t commented 10 months ago

Any fix for this ?

caiosilvestre commented 7 months ago

I was use wrong api key and receive thesame erro, Solution: Use correct api key

Shahed-mn commented 7 months ago

I was use wrong api key and receive thesame erro, Solution: Use correct api key

how did you obtain your api key? I have a basic paid account on midjourney

caiosilvestre commented 7 months ago

This video explain how to create a account in the next leg https://www.youtube.com/watch?v=93z375Ffs2U&t=1s

HaithemH commented 3 months ago

Dear How to set up the api key ?