Automating 12306 Train Ticket Queries: A Comparative Study of HTTP Scraping and Selenium Automation
Automating 12306 Train Ticket Queries: A Comparative Study of HTTP Scraping and Selenium Automation
Automating routine tasks on web platforms often requires choosing between lightweight API interaction and robust browser automation. This article details two Python implementations for querying train availability on the 12306 railway system. The ...
Posted on Fri, 08 May 2026 15:57:37 +0000 by maxelcat
Real-Time File Synchronization Using inotifywait and rsync
Real-Time Directory Synchronization
In production environments, maintaining consistent file states across multiple servers is critical. A common requirement involves continuously mirroring changes from a primary directory—such as an NFS export—to a designated path on a backup server.
Core Synchronization Approach
Two widely adopted methods enab ...
Posted on Fri, 08 May 2026 00:23:39 +0000 by hazel999
Retrieving Virtual Machine Device Information from ESXi Hosts Using Python
from pyVim.connect import SmartConnect
from pyVmomi import vim
import ssl
import json
def collect_vm_hardware(vm_obj):
hardware_list = []
try:
if vm_obj.config and hasattr(vm_obj.config.hardware, 'device'):
for hw in vm_obj.config.hardware.device:
if hasattr(hw.deviceInfo, 'label'):
...
Posted on Thu, 07 May 2026 10:21:46 +0000 by orange08
Python unittest Framework Fundamentals and Practical Usage
Core Components of unittest
The unittest module is Python’s built-in unit testing framework, inspired by JUnit. It revolevs around four foundational abstractions:
Test Case: A subclass of unittest.TestCase. Each method prefixed with test_ represents a individual test. The class may define setUp() and tearDown() for per-test setup and cleanup, ...
Posted on Thu, 07 May 2026 05:26:07 +0000 by fansa