-
Notifications
You must be signed in to change notification settings - Fork 77
requests.exceptions.InvalidHeader caused by Meta AI Cloudflare/Bot Challenge response #69
Copy link
Copy link
Open
Description
The application crashes when attempting to call ai.prompt() using the meta-ai-api library. It appears that Meta's servers are returning an HTML challenge page (likely a Cloudflare or bot protection wall) instead of the expected session tokens.
The library attempts to inject this HTML content directly into the request headers, triggering a requests.exceptions.InvalidHeader error because the header value contains reserved characters (like < > \n) from the HTML body.
Error Log
text
requests.exceptions.InvalidHeader: Invalid leading whitespace, reserved character(s), or returncharacter(s) in header value: "_js_datr=ml>\n\n<title>Meta AI</title>...
Steps to Reproduce
Initialize MetaAI() in a script.
Call ai.prompt(message="...").
The get_access_token() method fails when Meta returns a challenge page instead of a valid cookie/token.
Environment
Python Version: 3.11
Library: meta-ai-api (v1.2.5 based on traceback)
OS: Ubuntu (rehan-OptiPlex-5060)
Possible Root Cause
Bot Detection: Meta AI has flagged the request as automated and is serving a JavaScript/HTML challenge (executeChallenge()).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels