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

KeyError: "name='xs', domain=None, path=None" #17

Closed
RexsyBima opened this issue May 13, 2024 · 12 comments
Closed

KeyError: "name='xs', domain=None, path=None" #17

RexsyBima opened this issue May 13, 2024 · 12 comments

Comments

@RexsyBima
Copy link

when i ran the code from either python or jupiter notebook with these lines

from meta_ai_api import MetaAI

ai = MetaAI(fb_email="someemail", fb_password="somepassword")
response = ai.prompt(message="Whats the weather in San Francisco today? And what is the date?")
print(response)

i got


Traceback (most recent call last):
  File "d:\Python\metaaitest\main.py", line 185, in <module>
    funcGenNews(news)
  File "d:\Python\metaaitest\main.py", line 92, in funcGenNews
    ai = CustomMetaAI()
  File "d:\Python\metaaitest\src\meta_ai.py", line 19, in __init__
    super().__init__(fb_email=fb_email, fb_password=fb_password)
  File "D:\Python\tiktok-content-news-AI\.venv\lib\site-packages\meta_ai_api\main.py", line 50, in __init__
    self.cookies = self.get_cookies()
  File "D:\Python\metaaitest\.venv\lib\site-packages\meta_ai_api\main.py", line 316, in get_cookies
    fb_session = get_fb_session(self.fb_email, self.fb_password)
  File "D:\Python\metaaitest\.venv\lib\site-packages\meta_ai_api\utils.py", line 157, in get_fb_session
    "xs": session.cookies["xs"],
  File "D:\Python\metaaitest\.venv\lib\site-packages\requests\cookies.py", line 334, in __getitem__
    return self._find_no_duplicates(name)
  File "D:\Python\metaaitest\.venv\lib\site-packages\requests\cookies.py", line 413, in _find_no_duplicates
    raise KeyError(f"name={name!r}, domain={domain!r}, path={path!r}")
KeyError: "name='xs', domain=None, path=None"

im using vpn to avoid region block, yesterday was fine as butter. idk why it happens

@Strvm
Copy link
Owner

Strvm commented May 13, 2024

Hi, are you able to access it with your VPN on a browser?

@RexsyBima
Copy link
Author

Yup i can, im using windscribe

@Strvm
Copy link
Owner

Strvm commented May 13, 2024

Yup i can, im using windscribe

And could you try without authenticating and tell me what do you get

@RexsyBima
Copy link
Author

i got

Exception: Unable to obtain a valid response from Meta AI. Try again later.

just want to make sure, is it still working on your end?

@Strvm
Copy link
Owner

Strvm commented May 13, 2024

i got

Exception: Unable to obtain a valid response from Meta AI. Try again later.

just want to make sure, is it still working on your end?

Yep it works fine on my end, without a VPN (I'm in the US)

ai = MetaAI()
print(ai.prompt(message=f"Say this is a test 1"))
{'message': "Test 1 Successful! This is a test indeed! I'm ready to assist you with any questions or tasks you have. What's next?\n", 'sources': [], 'media': []}

@RexsyBima
Copy link
Author

im kinda worried it has something to do with my account, i did something in my facebook app which is that i created new fan page profile... ill try to create dummy fresh facebook account just in case, but not now, will try to do it tomorrow

@Strvm
Copy link
Owner

Strvm commented May 13, 2024

Not sure it has anything to do with your FB account since it should also work without authenticating

@RexsyBima
Copy link
Author

what python version are you using?

@Strvm
Copy link
Owner

Strvm commented May 13, 2024

The test was running 3.8, but that shouldn't really matter

@RexsyBima
Copy link
Author

RexsyBima commented May 13, 2024

so i use some dummy facebook account here, same code, but now i got KeyError instead

Traceback (most recent call last):
  File "d:\Python\meta-ai-api\test.py", line 3, in <module>
    ai = MetaAI(fb_email="xxxx", fb_password="xxxx")
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Python\meta-ai-api\.venv\Lib\site-packages\meta_ai_api\main.py", line 50, in __init__
    self.cookies = self.get_cookies()
                   ^^^^^^^^^^^^^^^^^^
  File "D:\Python\meta-ai-api\.venv\Lib\site-packages\meta_ai_api\main.py", line 316, in get_cookies
    fb_session = get_fb_session(self.fb_email, self.fb_password)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Python\meta-ai-api\.venv\Lib\site-packages\meta_ai_api\utils.py", line 210, in get_fb_session
    next_url = response.headers["Location"]
               ~~~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "D:\Python\meta-ai-api\.venv\Lib\site-packages\requests\structures.py", line 52, in __getitem__
    return self._store[key.lower()][1]
           ~~~~~~~~~~~^^^^^^^^^^^^^
KeyError: 'location'

@RexsyBima
Copy link
Author

Update for this, turns out Meta doesnt allow some dummy account to be using Meta.AI, kinda an L, when i access meta.ai manually using dummya account to login, i got kicked out from login page but there is notification what went wrong, therefore i assume it because i have this dummy account

so i use some dummy facebook account here, same code, but now i got KeyError instead

Traceback (most recent call last):
  File "d:\Python\meta-ai-api\test.py", line 3, in <module>
    ai = MetaAI(fb_email="xxxx", fb_password="xxxx")
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Python\meta-ai-api\.venv\Lib\site-packages\meta_ai_api\main.py", line 50, in __init__
    self.cookies = self.get_cookies()
                   ^^^^^^^^^^^^^^^^^^
  File "D:\Python\meta-ai-api\.venv\Lib\site-packages\meta_ai_api\main.py", line 316, in get_cookies
    fb_session = get_fb_session(self.fb_email, self.fb_password)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\Python\meta-ai-api\.venv\Lib\site-packages\meta_ai_api\utils.py", line 210, in get_fb_session
    next_url = response.headers["Location"]
               ~~~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "D:\Python\meta-ai-api\.venv\Lib\site-packages\requests\structures.py", line 52, in __getitem__
    return self._store[key.lower()][1]
           ~~~~~~~~~~~^^^^^^^^^^^^^
KeyError: 'location'

@RexsyBima
Copy link
Author

i got
Exception: Unable to obtain a valid response from Meta AI. Try again later.
just want to make sure, is it still working on your end?

Yep it works fine on my end, without a VPN (I'm in the US)

ai = MetaAI()
print(ai.prompt(message=f"Say this is a test 1"))
{'message': "Test 1 Successful! This is a test indeed! I'm ready to assist you with any questions or tasks you have. What's next?\n", 'sources': [], 'media': []}

Wait, can you try to do the same thing but with facebook login feature enabled? the only way i can get into it working before it bugged out is that i have to use login to the facebook feature

@Strvm Strvm closed this as completed Jul 27, 2024
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

2 participants