mrkeyoor.com_
Fri 18 Sept 16:00 UTC
Automationevaluationupdated 18 Sept 2026

py12306 review

py12306 is a Chinese-language Python assistant for buying train tickets through China's 12306 service; the repository has no English README. It watches dates, routes, trains, and seat types, then can place an order for configured passengers and send notifications, with optional Redis clustering and a web page.

Verdict

Our py12306 run installed 35 packages in 16 seconds, built in 1 second, and found no test target, so the environment is easy to reproduce while the booking path remains unverified. Use it as a Chinese-language codebase to study or repair, not as a dependable unattended buyer today. A real trial should stop before purchase until login, captcha, passenger data, and the reported initDc redirect have all been checked against the live service.

We ran it

Lab card: what happened when we ran py12306Screenshot of py12306 (github.com/pjialin/py12306)
Install✓ · 16s35 packages · 37 MB
Build✓ · 1s
Testsn/ano test script
Known vulns0(pip-audit)
Repo90 files~5,147 lines of source · 6.9 MB · 0 CI workflows · Dockerfile

Answers from our run

Does py12306 build from source?

Dependencies installed in 16 seconds (35 packages), and the build succeeded in 1 seconds. We cloned commit 52ccae8 into a clean Debian container with 3 CPUs and no project-specific setup.

Does py12306 have tests you can run?

Not through a standard command: the project exposes no test script or target that our harness could run.

Does py12306 have known vulnerabilities in its dependencies?

pip-audit found none in the dependency tree at the time of our run.

Who should not use py12306?

Anyone who needs current ticket purchase reliability without investigation: open issue 536 reports the confirmation flow redirecting to an error page after login and seat search succeeded.

What are the alternatives to py12306?

12306, easy12306, China Railway 12306. Our py12306 run installed 35 packages in 16 seconds, built in 1 second, and found no test target, so the environment is easy to reproduce while the booking path remains unverified.

Setup4/516-second install and 37 MB footprint; live setup needs credentials
Docs2/5Chinese-only guide with dated examples and service references
Community3/514,944 stars and recent issue activity, with 188 open issues
Maturity2/5No tests or CI, one 2019 release, and an open booking blocker

Who it’s for

Chinese-speaking developers studying how a 12306 booking client was assembled.
Users willing to test login, query, captcha, and order confirmation manually before trusting automation.
Operators who need several accounts or ticket tasks and understand the Redis cluster design.
Maintainers prepared to repair an external booking flow whenever 12306 changes it.

Who it’s NOT for

Anyone who needs current ticket purchase reliability without investigation: open issue 536 reports the confirmation flow redirecting to an error page after login and seat search succeeded.
English-only users: the README, configuration comments, issue reports, and web screenshots are in Chinese, with no English guide in the repository root.
Teams that require automated regression tests or CI before handling passenger data: our scan found no test target, no tests directory, and 0 CI workflows.
Users relying on the shared free captcha service: open issue 539 reports that path getting stuck before login, and the sample configuration says continued availability is not guaranteed.
Operators planning to run on any cheap cloud IP: the README warns that query and login traffic may be restricted on named Chinese cloud environments.

Setup reality

Our Python 3.12 install succeeded in 16 seconds, adding 35 packages and using 37 MB. The build completed in 1 second. The repository exposes no test script or target, so tests were skipped. Pip-audit reported 0 known vulnerabilities in the installed environment.

Real use requires a copied Python configuration containing account login mode, passenger names, dates, stations, seat preferences, and train filters. Optional voice, email, DingTalk, Telegram, WeChat, or Bark notifications need their own credentials. Distributed mode adds Redis; the web page listens on port 8008 when enabled.

The README says Python 3.6 or newer and offers direct and Docker paths. Its examples still contain 2020 travel dates, and the only GitHub release is v1.0.0 from 2019. Live 12306 behavior, captcha availability, and IP restrictions are runtime dependencies our package checks did not exercise.

Python 3.12 setup is easier than proving a purchase works

py12306 installed 35 packages on our Python 3.12 sandbox and occupied 37 MB. That is pleasantly small for an automation service with a web view, notifications, and optional clustering. The code handles several dates, accounts, ticket tasks, stations, seat preferences, and train filters. It can query without an account or log in and try to order for named passengers. The README is entirely Chinese, and the root contains no English translation.

The project asks for operational trust that a clean installation cannot establish. Buying a train ticket crosses login, captcha, passenger lookup, availability queries, order submission, confirmation, and notification services controlled by other parties. A change at any one boundary can leave the process running while the useful action fails. py12306 is best read as an integration that needs current live verification, rather than a utility whose behavior is fixed by the checked-out code.

A 1-second sample interval can drive several ticket tasks

The sample configuration sets a 1-second query interval and randomizes each request between half and all of that period. Every job names travel dates, departure and arrival stations, passengers, preferred seats, and optional train allow or deny lists. Multi-account and multi-thread modes broaden the search. The README also warns that query and login operations are separate and that certain Chinese cloud environments may have their IP addresses restricted. Users must choose a rate and host with that warning in mind.

Redis turns one process into a small cluster. A master distributes configuration, receives child-node messages, and can recover its role after a promoted child covered an outage. That can help several searches share state, but it also multiplies the number of clients touching a live ticket service. The cluster design does not prove that requests are accepted or that concurrent jobs respect current 12306 behavior. Start with one account and one query-only task before adding workers.

What happened when we ran it

Our sandbox installed py12306 in 16 seconds, adding 35 packages and using 37 MB on disk. The build step passed in 1 second. commit 52ccae8 had 90 files, about 5,147 lines of source, and a 6.9 MB checkout. Pip-audit found 0 known vulnerabilities in the installed Python packages. The repository includes a Dockerfile, while our scan found 0 CI workflow files and no tests directory.

There was no test script or target, so we skipped tests rather than inventing a result from the README's python main.py -t command. That command checks configured accounts, passengers, and stations against live services; it is an environment check, not an automated regression suite. Our run did not log in to 12306, solve a captcha, search a route, or submit an order. The passing build therefore says the Python project can be prepared, not that ticket automation currently succeeds.

Issue 536 reaches the order page and then gets redirected

Open issue 536 gives the clearest current warning. Its March 2026 report says login worked, seat queries found results, and submitOrderRequest returned success. The next initDc request went to an error page, leaving the client without the fields needed to continue order confirmation. The reporter reproduced a difference with browser context and suspected that the older requests-only sequence no longer matched the live service. No reply or closing fix appears on the issue.

Captcha and management paths have separate reports. Issue 539 says the free captcha route was stuck before login in June 2026. Issue 537 reports that the web page on port 8008 refused a connection alongside a Unicode decoding error. Each report concerns a particular environment, so none proves failure for every user. Together with the missing test target, they make a supervised trial mandatory before anyone stores real passenger details or waits for a scarce ticket.

The configuration holds passenger data and notification secrets

The sample env.py keeps user names, login mode, passenger names, routes, and task rules in Python. It can also hold an Aliyun voice app code, email credentials, DingTalk webhooks, Telegram URLs, ServerChan or PushBear keys, and Bark endpoints. Redis adds a host and optional password. The file is flexible, but it is also a collection of secrets and personal travel data that should stay out of Git and backups shared with other people.

QR login is the current sample default, with the password marked as ignored for that mode. Notification systems can be disabled, and query-only operation works without a booking account. Those narrower modes are the sensible first run. The web interface defaults to an admin and password example and port 8008, so replace the credentials and avoid exposing it publicly. The README describes user, task, and live-log viewing; it does not document internet-facing hardening.

A 2019 release coexists with 2026 dependency updates

GitHub lists v1.0.0 from March 2019 as the latest release. The default branch's newest visible commit was 52ccae8 on June 16, 2026, merging a PyJWT update. Nearby commits updated Flask, Werkzeug, requests, and lxml, largely through Dependabot. GitHub's repository record showed a September 17, 2026 last-push date, plus 14,944 stars and 195 combined issues and pull requests. A separate issue search found 188 open issues.

That activity is maintenance evidence, but recent dependency pins do not repair a changed booking protocol by themselves. The 0-vulnerability audit is good news for the environment we installed, while issue 536 remains the deciding functional evidence. py12306 is worth reading if you can work in Chinese and want to understand the moving parts of ticket automation. For an actual journey, use the official 12306 service unless you are prepared to debug every live step yourself.

Alternatives

ProjectWhat it isPick it when
12306An older Python ticket assistant that inspired part of py12306's implementation.pick this instead when comparing historical 12306 automation designs and an archived repository is acceptable.
easy12306A local image-recognition project for older 12306 captchas.pick this instead when captcha recognition research is the only requirement, not the full booking workflow.
China Railway 12306The official website and apps for searching and buying Chinese rail tickets.pick this instead when supported booking matters more than unattended automation.

What people are saying

  1. [github-trending] pjialin/py12306

Sources

  1. py12306 README
  2. py12306 sample configuration
  3. py12306 v1.0.0 release
  4. Issue 536: order confirmation redirect
  5. Issue 539: free captcha login failure
  6. Issue 537: web page connection failure

More automation reviews

goldie · TikTokDownloader · goreleaser · obscura · ios_rule_script · background-agents · the whole board →