Batch-upload up to 10 visitors per event to The Hong Kong Polytechnic University’s Visitor Registration System (VRS) through the (undocumented) AddRequestv2 API.
Everything is wrapped in a single Jupyter notebook for maximum transparency.
- Reads three local files you supply
Visitor.csv– a list of individual visitorsEvent.csv– event-level details (dates, sponsor info, etc.)Cookies.txt– four session cookies exported from your logged-in VRS browser session
- Splits visitors into batches of ≤ 10 (a VRS hard limit).
- Sanitises visit dates (caps stay at 13 days, no past dates).
- POSTs each batch to https://fmovrs.polyu.edu.hk/vrs-ajax/ShortVisiting/AddRequestv2 and prints the HTTP status + JSON response.
- Click the badge, then Runtime → Run all.
- When prompted, upload Visitor.csv, Event.csv, Cookies.txt.
- Watch the output pane for per-batch results.
git clone https://github.com/Benson-mk/PolyU_VRS_Batch_Registration.git
cd PolyU_VRS_Batch_Registration
python -m venv .venv && source .venv/bin/activate
jupyter notebook polyu_vrs_batch_registration.ipynb| accessDate | exitDate | organization | purposeOfVisit | accessLocation | sponsorDepartment | sponsorName | sponsorPhone | sponsorEmail | sponsorNetID |
|---|---|---|---|---|---|---|---|---|---|
| 2025-07-01 | 2025-07-05 | ABC Ltd | Demo Day | AAB G/F | COMP | Dr Chan C.W. | 12345678 | cw.chan@polyu.edu.hk | cwchan |
-
Dates must be
YYYY-MM-DD— but the notebook will self-heal if you leave a date blank or mistype it:Situation What the notebook does accessDateempty / badUses today’s date accessDatein the pastBumps it forward to today exitDateempty / badSets it to accessDate + 13 days Visit longer than 13 days Trims exitDateto accessDate + 13 days(13 days is hard-coded as
max_stay; change the constant near the top of the notebook if VRS updates its rule.)
| LName | FName | Mobile | |
|---|---|---|---|
| Smith | John | john.smith@example.com | 91234567 |
| Doe | Jane | jane.doe@example.com |
Mobileis optional; blank cells are okay.
Export these four cookies from an authenticated VRS tab:
BIGipServerPACI_VISITOR_44301_POOL
BIGipServerWAF_CM_PROD_HTTPS_POOL
.AspNetCore.Session
.AspNetCore.Cookies
Browser extensions such as Get cookies.txt LOCALLY let you Export cookies in Netscape format; save that as Cookies.txt.
┌── Visitor.csv (n rows) ─┐ ┌── Event.csv (m rows) ──┐
│ … visitor details … │ │ … event details … │
└─────────┬───────────────┘ └─────────┬──────────────┘
│ │
└─▶ Notebook slices visitors ◀──┘ (≤ 10 per batch)
│
├─ Creates JSON payload
└─ POST /ShortVisiting/AddRequestv2
max_visitorsandmax_stayare set to 10 and 13 days respectively – change the constants near the top if VRS updates its rules.
| Symptom | Likely cause & fix |
|---|---|
HTTP 401 / HTTP 403 |
Cookies expired → export a fresh Cookies.txt. |
HTTP 400 “visitor count exceeded” |
More than 10 visitors in a batch → check for blank lines. |
HTTP 500 |
VRS hiccup → re-run that cell in a few minutes. |
Pull requests welcome – especially for:
-
Handling future API schema changes
-
Adding CLI support (notebook → script)
-
Improving error handling / logging
Released under the MIT License.
This project is not affiliated with, endorsed by, or supported by The Hong Kong Polytechnic University. Use at your own risk.