Forum Discussion
Issue with definition for Fabric event-stream API
- Anonymous1 year ago
Hi chetanhiwale
Thank you for reaching out microsoft fabric community forum.The issue looks like it’s coming from how the request is being sent. In your code, when you're calling the requests.post() method, you're passing the payload dictionary directly using data=payload. But the data parameter expects a JSON string, not a raw Python dictionary.
To fix this, try converting the payload to a JSON string before sending it. Just update this line:
data = payload
to:
data = json.dumps(payload)
That should resolve the “unexpected character” error ("d" is from the dict string). Also, make sure your base64-encoded definition is valid and the Eventstream/workspace IDs are correct.
If this solution helps, please consider giving us Kudos and accepting it as the solution so that it may assist other members in the community
Thank you.
Hi datacoffee , thanks for pointing it out. As far as I can see, it is only variable , so it should affect it code execution. Even after correct the word, the error still persists. No sure exactly why I am getting this error.
I agree - the code looks good to me - I can't seem to find any error.
And yes - it is only a variable used in the "payload" definition.
I'm sorry for not being able to help more in this matter...