Skip to content

Add Frappe Data Transfer Endpoint and Test Harness for FastAPI Integration#2

Open
aiworkhackshop-design wants to merge 5 commits intoOpenNyAI:mainfrom
aiworkhackshop-design:frappe-transfer-connector
Open

Add Frappe Data Transfer Endpoint and Test Harness for FastAPI Integration#2
aiworkhackshop-design wants to merge 5 commits intoOpenNyAI:mainfrom
aiworkhackshop-design:frappe-transfer-connector

Conversation

@aiworkhackshop-design
Copy link
Copy Markdown

This pull request implements a generic data-transfer endpoint (POST /transfer/frappe) on the FastAPI backend to fulfil the C4GT bounty requirement for bridging a FastAPI service with a Frappe-based management system.

Key points

  • New Pydantic model: FrappeTransferInput defines doctype and payload so that any Frappe DocType can be created by simply posting JSON.
  • Environment-driven configuration: Reads FRAPPE_API_BASE_URL, FRAPPE_API_KEY and FRAPPE_API_SECRET from environment variables; no secrets are hard-coded.
  • Secure request forwarding: Uses an async httpx client with a token key:secret header to authenticate against Frappe. It propagates non-200 responses as HTTPException so clients receive clear error messages.
  • Graceful error handling: Validates the presence of configuration variables and wraps network errors, returning 502 Bad Gateway if the Frappe instance is unreachable.
  • Test harness: Added test_frappe_transfer.py, which demonstrates how to hit the new endpoint and prints the JSON response. It first exercises the summarization endpoint and then sends a sample payload to Frappe.

This change satisfies the bounty requirement to send JSON from a FastAPI service into a Frappe management system. With a properly configured Frappe environment, the endpoint will create or update documents without further modifications.

Implement summarization API with fallback to naive summarizer when no OpenAI key is set, and add /transfer/frappe endpoint using httpx and environment variables for secure Frappe API forwarding.
Include fastapi, uvicorn[standard], pydantic, langchain, langchain-openai, httpx for summarization and Frappe endpoints.
Provide Dockerfile to build and run the Next.js app in development mode. Copies dependencies and sets default command to npm run dev.
Provide an asynchronous test script to verify summarization and Frappe transfer endpoints using environment variables.
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

Successfully merging this pull request may close these issues.

1 participant