AshwinPathi / claude-api-py

Unofficial Python API for Anthropic's Claude LLM
https://pypi.org/project/claude-api-py/
MIT License
108 stars 11 forks source link

json.decoder.JSONDecodeError: Expecting value: line 2 column 9 #5

Closed Hongbin98 closed 11 months ago

Hongbin98 commented 11 months ago

After downloading all requirements, I try to run example.py.

However, it throws an error:

Traceback (most recent call last):
  File "example.py", line 109, in <module>
    main()
  File "example.py", line 27, in main
    organizations = client.get_organizations()
  File "D:\AppData\miniconda3\envs\myclaude2\lib\site-packages\claude\claude_client.py", line 255, in get_organizations
    return response.json()
  File "D:\AppData\miniconda3\envs\myclaude2\lib\site-packages\claude\custom_requests.py", line 41, in json
    return json.loads(self.data.decode("utf-8"))
  File "D:\AppData\miniconda3\envs\myclaude2\lib\json\__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "D:\AppData\miniconda3\envs\myclaude2\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "D:\AppData\miniconda3\envs\myclaude2\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)

It seems that this error may be caused by my lack of organization?

Thanks for your reply!

AshwinPathi commented 11 months ago

Do you have the correct session key? Usually if you fail on get_organizations() its probably due to incorrect authorization or incorrect headers.

I think every user should have at least one organization by default. To debug, try going to claude.ai/api/organizations in your broswer.

Hongbin98 commented 11 months ago

Do you have the correct session key? Usually if you fail on get_organizations() its probably due to incorrect authorization or incorrect headers.

I think every user should have at least one organization by default. To debug, try going to claude.ai/api/organizations in your broswer.

Thanks for your reply~

When I open the link claude.ai/api/organizations, I get {"uuid":"8da89060-XXXX","name":"linhongbinanthem@gmail.com's Organization", XXXX.

It throws a dictionary to me, and there is no any 'key' related to the organizations. Only the 'name' value is related to the 'organization' word :(

So I am still confused to solve this issue.

AshwinPathi commented 11 months ago

If you are comfortable editing the code, could you print out the response before calling response.json()? You do seem to have some organization so this shouldn't be an issue. It could be that there are weird characters in the response.

Hongbin98 commented 11 months ago

If you are comfortable editing the code, could you print out the response before calling response.json()? You do seem to have some organization so this shouldn't be an issue. It could be that there are weird characters in the response.

Sure, I got this message after print(respone)

Response(ok=True, data=b'\n        <!DOCTYPE html><html lang="en" prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#">\n\n    <head><link\nrel="dns-prefetch" href="https://www.anthropic.com/" crossorigin><link\nrel="preconnect" href="https://www.anthropic.com/" crossorigin><meta\ncharset="utf-8"><meta\nname="viewport" content="width=device-width,minimum-scale=1"><link\nrel="apple-touch-icon" sizes="180x180" href="https://www.anthropic.com/images/icons/apple-touch-icon.png"><link\nrel="icon" type="image/png" sizes="32x32" href="https://www.anthropic.com/images/icons/favicon-32x32.png"><link\nrel="icon" type="image/png" sizes="16x16" href="https://www.anthropic.com/images/icons/favicon-16x16.png"><link\nrel="manifest" href="https://www.anthropic.com/manifest.json"><link\nrel="mask-icon" href="https://www.anthropic.com/images/icons/safari-pinned-tab.svg" color="#191919"><link\nrel="shortcut icon" href="https://www.anthropic.com/favicon.ico"><meta\nname="msapplication-TileColor" content="#191919"><meta\nname="msapplication-config" content="https://www.anthropic.com/browserconfig.xml"><meta\nname="theme-color" content="#191919"><link\nrel="preload" href="https://www.anthropic.com/fonts/tiempos-text-regular.woff2" as="font" type="font/woff2" crossorigin><link\nrel="preload" href="https://www.anthropic.com/fonts/StyreneA-Regular-Web.woff2" as="font" type="font/woff2" crossorigin><link\nrel="preload" href="https://www.anthropic.com/fonts/StyreneA-Medium-Web.woff2" as="font" type="font/woff2" crossorigin><link\nrel="preload" href="https://www.anthropic.com/fonts/StyreneB-Regular-Web.woff2" as="font" type="font/woff2" crossorigin><link\nrel="preload" href="https://www.anthropic.com/fonts/StyreneB-Medium-Web.woff2" as="font" type="font/woff2" crossorigin><link\nrel="preload" href="https://www.anthropic.com/lottie/logo.min.json" as="fetch" crossorigin><link\nrel="stylesheet" href="/css/site.css?id=4a0dfa0862e98c28055d1841a09e9f14"><script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/embed/v2.js"></script>\n        \n    <title>App unavailable \\ Anthropic</title>\n<script>(function() {\nvar tag = document.createElement(\'script\');\ntag.src = "https://cdn.usefathom.com/script.js";\ntag.defer = true;\ntag.setAttribute("data-site", "FWWARNSL");\nvar firstScriptTag = document.getElementsByTagName(\'script\')[0];\nfirstScriptTag.parentNode.insertBefore(tag, firstScriptTag);\n})();\n</script><meta name="generator" content="SEOmatic">\n<meta name="description" content="Anthropic is an AI safety and research company that&#039;s working to build reliable, interpretable, and steerable AI systems.">\n<meta name="referrer" content="no-referrer-when-downgrade">\n<meta name="robots" content="all">\n<meta content="en_US" property="og:locale">\n<meta content="Anthropic" property="og:site_name">\n<meta content="website" property="og:type">\n<meta content="https://www.anthropic.com/app-unavailable-in-region" property="og:url">\n<meta content="App unavailable" property="og:title">\n<meta content="Anthropic is an AI safety and research company that&#039;s working to build reliable, interpretable, and steerable AI systems." property="og:description">\n<meta content="https://www-images.anthropic.com/production/images/anthropic-social_share.png?w=1200&amp;h=630&amp;q=82&amp;auto=format&amp;fit=crop&amp;dm=1676585898&amp;s=21b0a416036ef14a47124429243b4041" property="og:image">\n<meta content="1200" property="og:image:width">\n<meta content="630" property="og:image:height">\n<meta content="Anthropic logo" property="og:image:alt">\n<meta content="https://www.linkedin.com/company/anthropicresearch" property="og:see_also">\n<meta content="https://twitter.com/AnthropicAI" property="og:see_also">\n<meta name="twitter:card" content="summary_large_image">\n<meta name="twitter:site" content="@AnthropicAI">\n<meta name="twitter:creator" content="@AnthropicAI">\n<meta name="twitter:title" content="App unavailable">\n<meta name="twitter:description" content="Anthropic is an AI safety and research company that&#039;s working to build reliable, interpretable, and steerable AI systems.">\n<meta name="twitter:image" content="https://www-images.anthropic.com/production/images/anthropic-social_share.png?w=1200&amp;h=630&amp;q=82&amp;auto=format&amp;fit=crop&amp;dm=1676585898&amp;s=21b0a416036ef14a47124429243b4041">\n<meta name="twitter:image:width" content="1200">\n<meta name="twitter:image:height" content="630">\n<meta name="twitter:image:alt" content="Anthropic logo">\n<link href="https://www.anthropic.com/app-unavailable-in-region" rel="canonical">\n<link href="https://www.anthropic.com" rel="home">\n<link type="text/plain" href="https://www.anthropic.com/humans.txt" rel="author"></head>\n\n    <body class="first-load loading ">\n\n        \n    <div class="overlay-grid wrapper xs:grid xs:grid-2 s:grid-12">\n\t<div class="col-start-1 col-span-1">1</div>\n\t<div class="col-start-2 col-span-1">2</div>\n\t<div class="col-start-3 col-span-1 hide-on-mobile">3</div>\n\t<div class="col-start-4 col-span-1 hide-on-mobile">4</div>\n\t<div class="col-start-5 col-span-1 hide-on-mobile">5</div>\n\t<div class="col-start-6 col-span-1 hide-on-mobile">6</div>\n\t<div class="col-start-7 col-span-1 hide-on-mobile">7</div>\n\t<div class="col-start-8 col-span-1 hide-on-mobile">8</div>\n\t<div class="col-start-9 col-span-1 hide-on-mobile">9</div>\n\t<div class="col-start-10 col-span-1 hide-on-mobile">10</div>\n\t<div class="col-start-11 col-span-1 hide-on-mobile">11</div>\n\t<div class="col-start-12 col-span-1 hide-on-mobile">12</div>\n</div>\n    <div class="cover"></div>\n\n    <div class="modal-container">\n\n\t<div class="wrapper">\n\n\t\t<div class="modal-wrapper s:grid s:grid-12">\n\n\t\t\t<div class="modal s:col-start-3 s:col-span-8 l:col-start-4 l:col-span-6">\n\n\t\t\t\t<button class="btn-modal-close" aria-label="Close modal">\n\t\t\t\t\t<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="m10.543 30.958-1.5-1.5 9.5-9.458-9.5-9.458 1.5-1.5 9.458 9.5 9.458-9.5 1.5 1.5-9.5 9.458 9.5 9.458-1.5 1.5-9.458-9.5-9.458 9.5Z" fill="#191919"/></svg>\t\t\t\t</button>\n\n\t\t\t\t<div class="modal-content m:grid m:grid-8">\n\n\t\t\t\t\t<h2 class="m:col-start-2 m:col-span-6">Request Access</h2>\n\n\t\t\t\t\t<div id="modal-content-form-container" class="m:col-start-2 m:col-span-6">\n\n\t\t\t\t\t\t\n\t\t\t\t\t\t<script>\n\t\t\t\t\t\t\thbspt.forms.create({\n\t\t\t\t\t\t\t\tregion: "na1",\n\t\t\t\t\t\t\t\tportalId: "23987127",\n\t\t\t\t\t\t\t\tformId: "e6b0ec2c-fd03-4e24-8cbb-90d6cd357c18",\n\t\t\t\t\t\t\t\tformInstanceId: "modalRequestAccess",\n\t\t\t\t\t\t\t\ttarget: "#modal-content-form-container",\n\t\t\t\t\t\t\t\tcss:""\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t</script>\n\n\t\t\t\t\t</div>\n\n\t\t\t\t</div>\n\n\t\t\t</div>\n\n\t\t</div>\n\n\t</div>\n\n\t<div class="tint"></div>\n\n</div>\n    \n    \n\n    \n    \n<header class="core-header">\n\n    <div class="wrapper">\n\n        <a class="core-logo-link" href="https://www.anthropic.com/"  aria-label="Home">\n            <div class="logo-lottie"></div>        </a>\n\n        <button class="btn-core-mobile" aria-label="Navigation menu">\n            <svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5.418 25.375v-2.083h29.166v2.083H5.418Zm0-8.667v-2.083h29.166v2.083H5.418Z" fill="#191919"/></svg>        </button>\n\n                    \n<nav class="core-nav">\n\n    \n            \n                \n                    \n                                    \n            <a class="core-nav-link core-nav-link-product" href="https://www.anthropic.com/product" >Product</a>\n\n        \n            \n                \n                    \n                                    \n            <a class="core-nav-link core-nav-link-research" href="https://www.anthropic.com/research" >Research</a>\n\n        \n            \n                \n                    \n                                    \n            <a class="core-nav-link core-nav-link-company" href="https://www.anthropic.com/company" >Company</a>\n\n        \n            \n                \n                    \n                                    \n            <a class="core-nav-link core-nav-link-news" href="/index?subjects=announcements" >News</a>\n\n        \n            \n                \n                    \n                                    \n            <a class="core-nav-link core-nav-link-careers" href="https://www.anthropic.com/careers" >Careers</a>\n\n        \n    \n    \n    \n        \n                        \n                \n            <div class="nav-cta-wrapper" data-section-slugs="product">\n\n                                \n                    <button class="btn-primary btn-nav-cta" data-modal="requestAccess">\n                        <span class="btn-label">\n                            Request Access\n                            <span class="btn-anim" title="Request Access" aria-hidden="true"></span>\n                        </span>\n                    </button>\n\n                \n            </div>\n\n        \n    \n</nav>\n        \n        \n<div class="core-mobile-nav wrapper xs:grid xs:grid-2">\n\n\t<div class="controls xs:grid xs:grid-2 xs:col-start-1 xs:col-span-2">\n\n\t\t<div class="logo-mark xs:col-start-1 xs:col-span-1">\n\t\t\t<a href="https://www.anthropic.com/">\n\t\t\t\t<svg width="46" height="32" viewBox="0 0 46 32" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M32.73 0h-6.945L38.45 32h6.945L32.73 0ZM12.665 0 0 32h7.082l2.59-6.72h13.25l2.59 6.72h7.082L19.929 0h-7.264Zm-.702 19.337 4.334-11.246 4.334 11.246h-8.668Z" fill="#FAFAF7"/></svg>\t\t\t</a>\n\t\t</div>\n\n\t\t<button class="btn-close-mobile-nav xs:col-start-2 xs:col-span-1">\n\t\t\t<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="m10.543 30.958-1.5-1.5 9.5-9.458-9.5-9.458 1.5-1.5 9.458 9.5 9.458-9.5 1.5 1.5-9.5 9.458 9.5 9.458-1.5 1.5-9.458-9.5-9.458 9.5Z" fill="#FAFAF7"/></svg>\t\t</button>\n\n\t</div>\n\n\t<div class="footer-top xs:col-start-1 xs:col-span-2">\n\t\t<ul class="footer-primary">\n\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t<li><a href="https://www.anthropic.com/product" >Product</a></li>\n\n\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t<li><a href="https://www.anthropic.com/research" >Research</a></li>\n\n\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t<li><a href="https://www.anthropic.com/index" >Index</a></li>\n\n\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t<li><a href="https://www.anthropic.com/company" >Company</a></li>\n\n\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t<li><a href="/index?subjects=announcements" >News</a></li>\n\n\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t<li><a href="https://www.anthropic.com/careers" >Careers</a></li>\n\n\t\t\t\t\n\t\t\t\t\t</ul>\n\n\t\t<ul class="footer-additional">\n\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t<li><a href="mailto:info@anthropic.com" >Email</a></li>\n\n\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t<li><a href="https://twitter.com/AnthropicAI" target="_blank" rel="noopener noreferrer">Twitter</a></li>\n\n\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t<li><a href="https://www.linkedin.com/company/anthropicresearch" target="_blank" rel="noopener noreferrer">LinkedIn</a></li>\n\n\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t<li><a href="/terms" target="_blank" rel="noopener noreferrer">Terms of Service</a></li>\n\n\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t<li><a href="/privacy" target="_blank" rel="noopener noreferrer">Privacy Policy</a></li>\n\n\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t<li><a href="https://www.anthropic.com/responsible-disclosure-policy" >Responsible Disclosure Policy</a></li>\n\n\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t<li><a href="https://trust.anthropic.com" target="_blank" rel="noopener noreferrer">Compliance</a></li>\n\n\t\t\t\t\n\t\t\t\t\t</ul>\n\t</div>\n\n\t<div class="footer-bottom xs:col-start-1 xs:col-span-2">\n\t\t<div class="copyright">&copy; 2023 Anthropic PBC</div>\n\t</div>\n</div>\n\n    </div>\n\n</header>\n\n    <div class="cover-content"></div>\n\n    <div class="page-dom-content">\n        <main data-taxi>\n            \n    \t\t\t    \t\t\n\t\n        <article data-taxi-view="default" data-handle="default">\n\n            <div class="page-container">\n\n                <div class="custom-container wrapper">\n\n                    \n                    \n                                            \n\n\n<div class="b-hero-cta s:grid s:grid-12">\n\t\n\t<h1 class="heading s:col-start-3 s:col-span-8 text-center" data-triggers="splitWords" data-trigger-stagger-from="start">\n\t\t\t\t\t<div class="line-wrapper ">\n\t\t\t\t<span class="line line-1">\n\t\t\t\t\tApp unavailable\n\t\t\t\t</span>\n\t\t\t</div>\n\t\t\t</h1>\n\n\t<div class="description-wrapper s:col-start-4 s:col-span-6 spacer-medium-mt text-b1">\n\t\t<p>Unfortunately, Claude is only available in certain regions right now. Please contact help@anthropic.com if you believe you are receiving this message in error.</p>\n\t</div>\n\n\t<div class="cta-wrapper s:col-start-1 s:col-span-12 spacer-medium-mt">\n\n\t\t\t\t\t<a class="btn-primary" href="https://www.anthropic.com/supported-countries"  aria-label="View supported countries">\n\t\t\t\t<span class="btn-label">\n\t\t\t\t\tView supported countries\n\t\t\t\t\t<span class="btn-anim" title="View supported countries" aria-hidden="true"></span>\n\t\t\t\t</span>\n\t\t\t</a>\n\t\t\t\n\t</div>\n\n</div>\n\n                    \n                    \n                    \n\n\n                </div>\n\n                \n                \n                \n                \n                \n\n\n\n\n\n            </div>\n\n        </article>\n\n    \n        </main>\n\n        <footer class="core-footer">\n\n\t<div class="wrapper xs:grid xs:grid-2 s:grid-12">\n\n\t\t<div class="logo-mark xs:col-start-1 xs:col-span-1">\n\t\t\t<a href="https://www.anthropic.com/" aria-label="AI logo mark">\n\t\t\t\t<svg width="46" height="32" viewBox="0 0 46 32" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M32.73 0h-6.945L38.45 32h6.945L32.73 0ZM12.665 0 0 32h7.082l2.59-6.72h13.25l2.59 6.72h7.082L19.929 0h-7.264Zm-.702 19.337 4.334-11.246 4.334 11.246h-8.668Z" fill="#FAFAF7"/></svg>\t\t\t</a>\n\t\t</div>\n\n\t\t<div class="footer-top xs:col-start-1 xs:col-span-2 s:grid s:grid-6 s:col-start-5 s:col-span-8 m:col-start-5 m:col-span-6">\n\t\t\t<ul class="footer-primary s:col-start-1 s:col-span-2">\n\n\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t<li><a href="https://www.anthropic.com/product" >Product</a></li>\n\n\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t<li><a href="https://www.anthropic.com/research" >Research</a></li>\n\n\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t<li><a href="https://www.anthropic.com/index" >Index</a></li>\n\n\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t<li><a href="https://www.anthropic.com/company" >Company</a></li>\n\n\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t<li><a href="/index?subjects=announcements" >News</a></li>\n\n\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t<li><a href="https://www.anthropic.com/careers" >Careers</a></li>\n\n\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t</ul>\n\n\t\t\t<hr class="hide-on-desktop">\n\n\t\t\t<ul class="footer-social s:col-start-3 s:col-span-2">\n\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t<li><a href="mailto:press@anthropic.com" >Press Inquiries</a></li>\n\n\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t<li><a href="https://support.anthropic.com" target="_blank" rel="noopener noreferrer">Support</a></li>\n\n\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t<li><a href="https://twitter.com/AnthropicAI" target="_blank" rel="noopener noreferrer">Twitter</a></li>\n\n\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t<li><a href="https://www.linkedin.com/company/anthropicresearch/" target="_blank" rel="noopener noreferrer">LinkedIn</a></li>\n\n\t\t\t\t\t\n\t\t\t\t\t\t\t</ul>\n\n\t\t\t<hr class="hide-on-desktop">\n\n\t\t\t<ul class="footer-legal s:col-start-5 s:col-span-2">\n\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t<li><a href="/terms" target="_blank" rel="noopener noreferrer">Terms of Service</a></li>\n\n\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t<li><a href="/privacy" target="_blank" rel="noopener noreferrer">Privacy Policy</a></li>\n\n\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t<li><a href="https://www.anthropic.com/responsible-disclosure-policy" >Responsible Disclosure Policy</a></li>\n\n\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t<li><a href="https://trust.anthropic.com" target="_blank" rel="noopener noreferrer">Compliance</a></li>\n\n\t\t\t\t\t\n\t\t\t\t\t\t\t</ul>\n\t\t</div>\n\n\t\t<div class="footer-bottom xs:col-start-1 xs:col-span-2 s:col-start-5 s:col-span-8 m:col-start-11 m:col-span-2">\n\t\t\t<div class="copyright">&copy; 2023 Anthropic PBC</div>\n\t\t</div>\n\n\t</div>\n\n</footer>\n    </div>\n\n\n        <script src="/js/site.js?id=9c708111992f94585c703251d84eb26b"></script>\n\n    <script type="application/ld+json">{"@context":"http://schema.org","@graph":[{"@type":"WebPage","author":{"@id":"https://anthropic.com#identity"},"copyrightHolder":{"@id":"https://anthropic.com#identity"},"copyrightYear":"2023","creator":{"@id":"https://anthropic.com#creator"},"dateModified":"2023-05-11T07:21:04-07:00","datePublished":"2023-03-03T21:21:00-08:00","description":"Anthropic is an AI safety and research company that\'s working to build reliable, interpretable, and steerable AI systems.","headline":"App unavailable","image":{"@type":"ImageObject","url":"https://www-images.anthropic.com/production/images/anthropic-social_share.png?w=1200&h=630&q=82&auto=format&fit=crop&dm=1676585898&s=21b0a416036ef14a47124429243b4041"},"inLanguage":"en-us","mainEntityOfPage":"https://www.anthropic.com/app-unavailable-in-region","name":"App unavailable","publisher":{"@id":"https://anthropic.com#creator"},"url":"https://www.anthropic.com/app-unavailable-in-region"},{"@id":"https://anthropic.com#identity","@type":"LocalBusiness","alternateName":"Anthropic","description":"Anthropic is an AI safety and research company. We build reliable, interpretable, and steerable AI systems.","name":"Anthropic PBC","priceRange":"$","sameAs":["https://twitter.com/AnthropicAI","https://www.linkedin.com/company/anthropicresearch"],"url":"https://anthropic.com"},{"@id":"#creator","@type":"Organization"},{"@type":"BreadcrumbList","description":"Breadcrumbs list","itemListElement":[{"@type":"ListItem","item":"https://www.anthropic.com","name":"Home","position":1},{"@type":"ListItem","item":"https://www.anthropic.com/app-unavailable-in-region","name":"App unavailable","position":2}],"name":"Breadcrumbs"}]}</script></body>\n\n</html>\n\n')
AshwinPathi commented 11 months ago

Do you use a VPN on your broswer? It seems like when sending this request, it fetches the "Request Access" page and says that "Claude is only available in certain regions right now."

You might need to use a proxy/vpn to use this library, though I have not tested with one personally.

Hongbin98 commented 11 months ago

Do you use a VPN on your broswer? It seems like when sending this request, it fetches the "Request Access" page and says that "Claude is only available in certain regions right now."

Thanks for @AshwinPathi , the issue has been already solved after changing the VPN to Global mode in American nodes.

If someone also meet this problem, you can fix it by:

  1. before calling response.json(), print(respone)
  2. check if there is the problem that "Claude is only available in certain regions right now."
  3. changing the VPN to Global mode with American nodes