Skip to content

Instantly share code, notes, and snippets.

@jrasanen
Created December 19, 2017 16:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrasanen/0c6a053fb927aea68e2dcb1e4c379daa to your computer and use it in GitHub Desktop.
Save jrasanen/0c6a053fb927aea68e2dcb1e4c379daa to your computer and use it in GitHub Desktop.
poll for postipaketti
#!/bin/bash
if ! [ -x "$(command -v jj)" ]; then
brew tap tidwall/jj
brew install jj
fi
while true; do
echo -n "`date` " && \
curl -s 'https://www.posti.fi/henkiloasiakkaat/seuranta/api/shipments' \
--data '{"trackingCodes":["JJFI..."]}' \
-H 'Content-Type: application/json;charset=utf-8' \
| jj shipments.0.events.0.description.fi \
| xargs
sleep 1;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment