The agent that turns websites into APIs!
Merge branch 'main' into feat/typescript-client-gen
kalil03210555bf125e1e
diff --cc src/reverse_api/base_engineer.pyindex 24232b2,edaa5b5..75317f6--- a/src/reverse_api/base_engineer.py+++ b/src/reverse_api/base_engineer.py@@@ -282,7 -133,42 +285,13 @@@ Your task is to- Query parameters vs body parameters- Response data structures+ 4. **Ask clarifying questions using AskUserQuestion** if needed:+ - When multiple authentication methods are found, ask which to prioritize+ - If uncertain about feature priorities, ask the user+ - When implementation approaches are ambiguous, ask for preferences+ - Use the tool for any clarifications that would improve the final code+-5. **Generate a Python script** that replicates these API calls with the following requirements:- - Use the `requests` library as the default choice- - Include proper authentication handling (sessions, headers, tokens)- - Create separate functions for each distinct API endpoint- - Include type hints for all function parameters and return values- - Write comprehensive docstrings for each function- - Implement proper error handling with try-except blocks- - Add logging for debugging purposes- - Make the code production-ready and maintainable- - Include a main section with example usage--6. **Create documentation**:- - Generate a README.md file that explains:- - What APIs were discovered- - How authentication works- - How to use each function- - Example usage- - Any limitations or requirements--7. **Test your implementation**:- - After generating the code, test it to ensure it works- - You have up to 5 attempts to fix any issues- - If the initial implementation fails, analyze the error and try again- - Keep in mind that some websites have bot detection mechanisms--8. **Handle bot detection**:- - If you encounter bot detection, CAPTCHA, or anti-scraping measures with `requests`- - Consider switching to Playwright with CDP (Chrome DevTools Protocol)- - Use the real user browser context to bypass detection- - Maintain the same code quality standards regardless of approach+{self._get_language_instructions()}Before generating your code, use a scratchpad to plan your approach:@@@ -291,10 -177,17 +300,12 @@@ In your scratchpad- Summarize the key API endpoints found in the HAR file- Note the authentication mechanism being used- Identify any patterns or commonalities between requests-- Plan the structure of your Python script+- Plan the structure of your {language_name} code- Consider potential issues (rate limiting, bot detection, etc.)+ - Decide whether `requests` will be sufficient or if Playwright is needed+ - Identify any ambiguities or questions you should ask the user using AskUserQuestion</scratchpad>-After your analysis, generate the files:--1. Save the Python script to: {self.scripts_dir}/api_client.py-2. Save the documentation to: {self.scripts_dir}/README.md-If your first attempt doesn't work, analyze what went wrong and try again. Document each attempt and what you learned.<attempt_log>