Skip to content

Instantly share code, notes, and snippets.

[~/ - kurt@bastion] curl -v https://www.hermesparcelreturn.co.uk/
* Trying 45.60.1.42...
* TCP_NODELAY set
* Connected to www.hermesparcelreturn.co.uk (45.60.1.42) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: /etc/ssl/certs
kurt@grafana:~/ticker$ cat sp500.py
import requests
try:
info = requests.get("https://query1.finance.yahoo.com/v8/finance/chart/VUSA.L?region=US&lang=en-US&includePrePost=false&interval=1d&range=1d&corsDomain=finance.yahoo.com&.tsrc=finance").json()
lastPrice = round(info['chart']['result'][0]['indicators']['quote'][0]['close'][-1],2)
prevClose = info['chart']['result'][0]['meta']['chartPreviousClose']
change = '{0:.2f}'.format(((lastPrice / prevClose -1) * 100)) + "%"
print("ticker sp500=\"£" + str(lastPrice)[:5] + " (" + change + ")\"")
except:
{
"cacheTimeout": null,
"colorBackground": false,
"colorValue": true,
"colors": [
"#bf1b00",
"#bf1b00",
"#299c46"
],
"datasource": "telegraf",

Keybase proof

I hereby claim:

  • I am kurtmclester on github.
  • I am kmc (https://keybase.io/kmc) on keybase.
  • I have a public key ASAvdGrsrMuC5-PhHXaO0NXyaX7b8a2uA3OKMR7-iNFgMAo

To claim this, I am signing this object:

import json
import urllib2
import StringIO
import gzip
from time import sleep
from os import system
import platform
oldUsers = {}