Python Microservice for Bubble?

Any python addicts here like me?

I want to connect (via API) an EC2 Microservice to Bubble forthe following use case:

  • User inputs data
  • Data is sent to EC2 from the Bubble API
  • The python scripts runs
  • the results are returned to Bubble API

Any tips on how to do it the most painless way, as i need to create multiple microservices for my app. I really suck at debugging the Bubble API, i always get different results to what i get in postman for example, so any tips will be appreciated.

2 Likes

Hey @Bubbler,

I’ve done this. My approach was to create external endpoints and then use the api connector in Bubble to trigger various calculations, etc. Sometimes I return the results immediately to Bubble and in other cases, I queue up worker threads in python and then send a notification back to a Bubble endpoint with the results. For example, I built a CSV uploader where I have python parse the csv and return the column headers so users can map to bubble fields – then I trigger python to spin through the csv and create records in bubble using the data api.

It helps me get over any gaps in Bubble and is much better for data processing.

4 Likes

also interested in doing this…

is there a best practice in some docs here on the authentication aspect? do the user-facing auth in Bubble, pass credentials or token over to the api so the api doesn’t do otherwise? I don’t really want to learn how to do oauth on the api writing side, but will do it if really needed.

My approach was to build as a plugin and this post from @emmanuel talks about securing token’s etc. as there are definitely good and bad ways to implement. You can secure your endpoint with http basic auth, or a token, or whatever else the api connector and your endpoint both support.

1 Like

cool thanks i’ll check that out starting tonight! going to start as simply as possible

Thank you for your comment!

I realize this is probably something you did on your production app, but is there any way you could share some components of the editor?

Sorry if thats a lot to ask :slight_smile:

All I would be showing you is an api connector call very specific to my needs, but if using that is new to you, check out this course from @romanmg

2 Likes

We’ve used Amazon Lambda for the same thing (instead of EC2). Lambda is designed for this use case so it works a bit better, is much cheaper, runs scripts without a database, and I believe works particularly well with Python.

4 Likes

Bubble is SOOOO cool!!! It seems like every time I read a new post I learn about a really neat thing we can do with it.

3 Likes

Yes, and the best thing, the community is really great.

I could ask something about rocket science and someone will always be able to help, this is one of the best online communities i’ve been at, no kidding.

2 Likes