Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why does the response appear in HTML format instead of json format when I run it? #5

Open
Bkinsjuwo opened this issue Oct 5, 2023 · 3 comments

Comments

@Bkinsjuwo
Copy link

Why does the response appear in HTML format instead of json format when I run it?

@Nipun1212
Copy link
Owner

which function are you calling to get the response. and can you send the picture of the issue.
Thanks

@roaringmyshallowwater
Copy link

roaringmyshallowwater commented Oct 30, 2023

i have encountered a similar error.
`
def get_organization_id(self):
url = "https://claude.ai/api/organizations"

headers = {
    'User-Agent':
    'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0',
    'Accept-Language': 'en-US,en;q=0.5',
    'Referer': 'https://claude.ai/chats',
    'Content-Type': 'application/json',
    'Sec-Fetch-Dest': 'empty',
    'Sec-Fetch-Mode': 'cors',
    'Sec-Fetch-Site': 'same-origin',
    'Connection': 'keep-alive',
    'Cookie': f'{self.cookie}'
}

response = requests.get(url, headers=headers, impersonate="chrome110")
res = json.loads(response.text)
uuid = res[0]['uuid']

return uuid

`

Traceback (most recent call last):
File "xxxxxx\Claude-API-main\usecases\console_chat.py", line 32, in
main()
File "xxxxxxxxxxxxxx\Claude-API-main\usecases\console_chat.py", line 12, in main
claude = Client(cookie)
File "xxxxxxxx\Claude-API-main\claude-api\claude_api.py", line 13, in init
self.organization_id = self.get_organization_id()
File "xxxxxxx\Claude-API-main\claude-api\claude_api.py", line 33, in get_organization_id
res = json.loads(response.text)
File "C:\Users\XXX\AppData\Local\Programs\Python\Python39\lib\json_init_.py", line 346, in loads
return _default_decoder.decode(s)
File "C:\Users\XXX\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\XXX\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 2 column 9 (char 9)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants