py12306 is a ticket-buying helper for 12306, the official online booking site for trains in mainland China. The project is written in Python and is aimed at people who want to grab tickets for popular routes where seats sell out quickly. According to the README, it lets you search for remaining tickets across multiple dates, log in with several accounts at once, run many buying tasks in parallel, and place orders automatically when a seat becomes available. The README lists the features the project supports today. Among them: automatic captcha solving, recovery of user login state, voice phone notifications, email notifications, WeChat push messages via DingTalk, Telegram, ServerChan, and PushBear, querying a single task across multiple stations, and a web management page for viewing users, tasks, and live logs. A proxy pool feature is listed as not yet done. The captcha service currently relies on a free shared platform run by the author. To use it you need Python 3.6 or newer. You clone the repo, install the dependencies from requirements.txt, copy env.py.example to env.py, edit the config, then run python main.py. A -t flag runs a configuration test, and -n adds a notification test. The project also supports running as a distributed cluster, where one master node and several child nodes share work through Redis. If the master crashes, a child node is promoted automatically. A Docker image and a docker-compose example are provided. The project is released under the Apache License.
Generated 2026-05-21 · Model: sonnet-4-6 · Verify against the repo before relying on details.