5

I've been wandering around with a brain itch for the past few days trying to pick an API framework.

I wanted to something fast and async, so I would normally use Go, but it's an interface to a python project, so I had to find a good asynchronous python web server.

Twisted provides async options, but they aren't baked in, and tornado/cyclone/airohttp are written in a weird way for someone coming from flask/Django.

Finally I resolved to use Falcon, because it was built for APIs and async by default, but it was crazy verbose to write. I settled in to write it anyway... But then I found the perfect library. Hug: https://github.com/timothycrosley/....

I can finally think clearly.

Now I can finally write my code... At least until I have to pick a framework for the rewrite of the web app.

Comments
  • 1
    Using both falcon and twisted for almost a year now. These two are the bet frameworks .You can't go with any less code with falcon very easy to setup and Zero boilerplate code. twisted is such an.awesome framework I can't explain in words I had the similar reaction to it at first but it takes time to read and understand it's working .If all you need is 100 or so users you can go with anything you want but there are so many projects that I have worked in past one year (millions of request per second ) and other custom network apps which is just impossible without twisted . Put your effort in twisted and you will be able stop doing everything using http
  • 0
    @anekix I actually found out today that hug won't really meet my needs. Is twisted really that good? My userbase ATM is around 500 users but I'm looking to expand.

    It's between twisted or falcon for me now. Which would you choose?

    I have some API calls that could potentially take quite awhile (relying on external services), so I'm pretty sure I need some form of async, right?
  • 1
    @willbeddow if you think you will need asynchronous for only some APIs then use can go with falcon+celery...Very clean API design you will get and it will be very easy to manage later on trust me.but if your app needs to make use of other protocols other than http and need something custom or heavy use of async then I suggest go with twisted.
  • 0
    @anekix Thanks! I think I might want to explore websockets later on, so I'll check out twisted. Appreciate the advice!
  • 1
    @willbeddow and yes twisted is really that good I mean I was frustrated when I started it took me almost 2 months to study it in detail.but since then I have worked on projects with very high requirements ,minimum latency and tons of features that was so easy to get done with twisted. Asyncio is just a language feature which cannot be compared to twisted.how about writing a proxy server?Load balancer with custom requirements or even SMTP server or a very robust DNS server?It will literally take minutes to get these done with twisted .
Add Comment