Client libraries
On this page
The client libraries call the API from Python and from Node. They log in, keep the access token fresh, and wait and retry when the API asks them to.
Python
The package is reconnectchina. It needs Python 3.11 or later and has no dependencies.
pip install reconnectchinaIn a project managed with uv:
uv add reconnectchinaNode
The package is @reconnectchina/client. It needs Node 20.3 or later.
npm install @reconnectchina/clientShell
No library is needed: the samples use curl, and the login pages' scripts also use jq on another website to read the login server's answers. The operation pages' commands need curl only.
The samples
Every operation page shows its request in Python, curl and Node. The Python and Node samples are
the call alone: they run on a client that is logged in, which the login pages make. For whole
programs that log in, call several operations and write a file, see the
examples.
The Node samples are written for an ES module, a .mjs file or a package with
"type": "module": they use import and await at the top level. To try one in the node
shell, load the client with const { Client } = await import("@reconnectchina/client"); instead of
its import line.
- To try things out, Logging in makes a client whose login ends with your session at reconnectchina.org.
- For a script that runs without you, Creating a token for a script creates an offline token once and saves it in a file; every later run makes its client from that file (Using a saved token).
Put an operation's sample below either one. The curl commands read an access token from
$TOKEN, which the shell sample under Using a saved
token sets. While you are logged in, Copy with
your token copies an operation's command with yours filled in instead, for a terminal or a
REST client. It works for five minutes.