Easy Code Share >

Python Parallel for Loop on Producer-consumer Model

Python Parallel for Loop on Producer-consumer Model

Python parallel for loop can simplify the producer-consumer model, and we provide a simple Python example that uses the async thread module, asyncio, for demonstration. The example simulates the behaviors of restaurant’s cookers and their customers. Briefly, Python language provides a quick method to execute for loop in parallel that meets the feature of such … Read more

Easy Code Share >

Solving Post JSON to Python CGI FieldStorage Error

Solving Post JSON to Python CGI FieldStorage Error

Python CGI module gets popular among developers for only unstructured data, but its FieldStorage() gives rise to an error for posting JSON data. The article describes the problem in details and raise a solution. You should configure Apache CGI on Windows or Linux before studying this topic, because practices make perfect. All codes here are … Read more

Easy Code Share >

WSGI App in Python under Apache mod_wsgi

WSGI App in Python under Apache mod_wsgi

Walking through an example, you will learn how to install and configure mod_wsgi on Apache, and enable a Python wsgi app. Accordingly, the app accepts GET and POST data and replies with text, html or json data. Unfortunately, the ways to retrieval of GET and POST parameters from mod_wsgi are different. But when you understand … Read more

Easy Code Share >

Python HTTP Server Accept File Upload in Two Ways

Python HTTP Server Accept File Upload in Two Ways

Upon Apache CGI, Python scripts play the role of HTTP web server that accepts both single and multiple file upload. In the article, first, we review methods of file upload in HTML browser, and then focus on Python scripts about how to receive and store files. All codes here are not complicated, so you can … Read more

Easy Code Share >

Scraping Three Global Weather Channels by Tricks

Scraping Three Global Weather Channels by Tricks

Using web scraping techniques to add a weather crawler module in your apps can help users to crawl temperature and more weather info as they want. For weather inquiry, you can call weather APIs provided by Bureau of Meteorology, or crawl Google and some weather channels. All codes here are not complicated, so you can … Read more

Easy Code Share >

Telegram Bot API Send Weather Message by Python

Telegram Bot API Send Weather Message by Python

Based on the example of a Telegram weather bot, let us learn how Python scripts send messages to apps by using Telegram API. The procedural steps are made up of registering a bot, creating a daemon process for the bot, and handling requests with the help of web crawling skills. All codes here are not … Read more

Easy Code Share >

Python Webapp Demo on Apache CGI for Windows

Python Webapp Demo on Apache CGI for Windows

For Python webapp scripts to run, we enumerate the most concise steps to Apache CGI configuration on Windows and Linux. The JS scripts in browser clients request not only PHP scripts on server sites, but also more competitive services from Python data science and AI. We will guide you on developing mode in Windows, and … Read more

Easy Code Share >

3 Steps Line Notify API Inform Group Member by Token

3 Steps Line Notify API Inform Group Members by Token

Line Notify API with an authorized token allows web applications to occasionally fire information to registered people. If web applications act as services, these services are no longer passive. Services can actively pass messages to users on conditional events or by scheduled jobs. We use Python scripts to implement Line Notify in the post. Line … Read more

Easy Code Share >

MQTT Python Client Example to a Free MQTT Server

MQTT Python Client Example to a Free MQTT Server

We provide a MQTT client example using Python, and furthermore, reveal for you extra information about a free MQTT broker server. You don’t have to build a MQTT broker for testing programs, the free broker can help your study. All codes here are not complicated, so you can easily understand even though you are still … Read more

Easy Code Share >

Python Web Scraping using BeautifulSoup in 3 Steps

Python Web Scraping using BeautifulSoup in 3 Steps

Web Scraping means navigating structured elements on a website, and deeply going to next layers. Incoming big data will be retrieved and formated in desired styles. We apply Python BeautifulSoup to a simple example for scraping with step-by-step tutorials. All codes here are not complicated, so you can easily understand even though you are still … Read more