API issue

Hi mods and support, I'm trying to extract data from site. I used to code recommanded by the documentation
# Install with pip install firecrawl-py
from firecrawl import FirecrawlApp
from pydantic import BaseModel, Field
from typing import Any, Optional, List

app = FirecrawlApp(api_key='fc-000000000000000000') #I put the good one on my code



class ExtractSchema(BaseModel):
github_link: str

data = app.extract([
"https://traget-url" #I put the good one on my code
], {
'prompt': 'Find the GitHub repository URL for this project or organization. Return only the URL',
'schema': ExtractSchema.model_json_schema(),
'enable_web_search': True
})
# Install with pip install firecrawl-py
from firecrawl import FirecrawlApp
from pydantic import BaseModel, Field
from typing import Any, Optional, List

app = FirecrawlApp(api_key='fc-000000000000000000') #I put the good one on my code



class ExtractSchema(BaseModel):
github_link: str

data = app.extract([
"https://traget-url" #I put the good one on my code
], {
'prompt': 'Find the GitHub repository URL for this project or organization. Return only the URL',
'schema': ExtractSchema.model_json_schema(),
'enable_web_search': True
})
And i have this error :
Error extracting GitHub URLs: ("Unexpected error during extract: Status code 400. Bad Request - [{'code': 'unrecognized_keys', 'keys': ['enable_web_search'], 'path': [], 'message': 'Unrecognized key in body -- please review the v1 API documentation for request body changes'}]", 500)
Error extracting GitHub URLs: ("Unexpected error during extract: Status code 400. Bad Request - [{'code': 'unrecognized_keys', 'keys': ['enable_web_search'], 'path': [], 'message': 'Unrecognized key in body -- please review the v1 API documentation for request body changes'}]", 500)
I tried other way to code this but i keep getting the error like this :
1 Reply
ΛᄃDᄃ
ΛᄃDᄃOP9mo ago
# Install with pip install firecrawl-py
from firecrawl import FirecrawlApp
from pydantic import BaseModel
from typing import Optional, List, Dict

class GithubUrlSchema(BaseModel):
"""Schema for GitHub URL extraction"""
github_link: str

class GithubExtractor:
def __init__(self, api_key: str):
"""Initialize the GitHub URL extractor

Args:
api_key (str): Firecrawl API key
"""
self.app = FirecrawlApp(api_key=api_key)

def extract_github_urls(self, urls: List[str]) -> Optional[List[Dict]]:
"""Extract GitHub URLs from given websites

Args:
urls (List[str]): List of website URLs to analyze

Returns:
Optional[List[Dict]]: List of extracted GitHub URLs or None if error
"""
try:
# Configure extraction parameters
extraction_config = {
'prompt': 'Find the GitHub repository URL for this project or organization. Return only the URL as github_link.',
'schema': GithubUrlSchema.model_json_schema(),
'enable_web_search': True # Enable web search for better results
}

# Extract data using Firecrawl
results = self.app.extract(urls, extraction_config)

return results

except Exception as e:
print(f"Error extracting GitHub URLs: {str(e)}")
return None

def main():
"""Main function to demonstrate usage"""
# Initialize extractor with your API key
extractor = GithubExtractor(api_key='fc-000000000000000000000')

# Example usage
urls = ["https://target-url"]
results = extractor.extract_github_urls(urls)

if results:
for result in results:
print(f"GitHub URL: {result.get('github_link')}")

if __name__ == "__main__":
main()
# Install with pip install firecrawl-py
from firecrawl import FirecrawlApp
from pydantic import BaseModel
from typing import Optional, List, Dict

class GithubUrlSchema(BaseModel):
"""Schema for GitHub URL extraction"""
github_link: str

class GithubExtractor:
def __init__(self, api_key: str):
"""Initialize the GitHub URL extractor

Args:
api_key (str): Firecrawl API key
"""
self.app = FirecrawlApp(api_key=api_key)

def extract_github_urls(self, urls: List[str]) -> Optional[List[Dict]]:
"""Extract GitHub URLs from given websites

Args:
urls (List[str]): List of website URLs to analyze

Returns:
Optional[List[Dict]]: List of extracted GitHub URLs or None if error
"""
try:
# Configure extraction parameters
extraction_config = {
'prompt': 'Find the GitHub repository URL for this project or organization. Return only the URL as github_link.',
'schema': GithubUrlSchema.model_json_schema(),
'enable_web_search': True # Enable web search for better results
}

# Extract data using Firecrawl
results = self.app.extract(urls, extraction_config)

return results

except Exception as e:
print(f"Error extracting GitHub URLs: {str(e)}")
return None

def main():
"""Main function to demonstrate usage"""
# Initialize extractor with your API key
extractor = GithubExtractor(api_key='fc-000000000000000000000')

# Example usage
urls = ["https://target-url"]
results = extractor.extract_github_urls(urls)

if results:
for result in results:
print(f"GitHub URL: {result.get('github_link')}")

if __name__ == "__main__":
main()

Did you find this page helpful?