Feng's Notes Isn't coding fun?
Posts with the tag python:

Run Multiple Asyncio Frameworks, is it possible?

The answer is yes. But it’s not a trivial task. I had this question when I was working on a telegram bot with python telegram bot(PTB) framework, while I also want to run a fastapi server using uvicorn. PTB is built on top of asyncio and if you run Application.run_polling() it will block the event loop. So I had to find a way to let both run without blocking. Option 1: Embed the other asyncio frameworks in one event loop Actually this is the recommended way to run multiple asyncio (including webserver or another bot), the given example is as follows:

Task queues in different languages

Task queue is used widely in software development. It is a mechanism to distribute work across threads or machines. It is also a way to coordinate workers to perform tasks. The scenario could be a web application that needs to process a large number of requests, a data pipeline that needs to process a large amount of data or a scheduled job that needs to run periodically. I have used task queues in different languages.

Streamlit app to manage your cloudflare images

In my previous article I introduced how to build a sql chatbot with langchain and streamlit. I was then thinking if I can use streamlit to manage my image gallery on cloudflare. I found it was as easy as I thought, of course with a bit help of chatgpt.. Why I need this I have been using cloudflare images service for a while and satisfied with its speed. However, it doesn’t have a good UI tool.