Ejemplo n.º 1
0
	def load(cls):
		feed = util.getJSON("https://api.github.com/users/porter77/repos")
		for item in feed:
			obj = cls(id=str(item["id"]))
			obj.title = item["name"]
			obj.date = datetime.strptime(item["pushed_at"], "%Y-%m-%dT%H:%M:%SZ")
			obj.url = item["html_url"]
			obj.save()
Ejemplo n.º 2
0
def getData(address):

    #TODO: cache this on the server so we don't have to make a request to blockchain every time a user hits the site
    # grab new data at a max rate of every 5 minutes
    url = 'http://blockchain.info/address/' + address + '?format=json'
    json = util.getJSON(url)

    return json
def getData(address):

	#TODO: cache this on the server so we don't have to make a request to blockchain every time a user hits the site
	# grab new data at a max rate of every 5 minutes
	url = 'http://blockchain.info/address/' + address + '?format=json'
	json = util.getJSON(url);

	return json
Ejemplo n.º 4
0
def getTargetAddress():
	address = PotAddress.getCurrentAddress(startDate)
	data = PotAddress.getData(address)

	# current value of BTC in USD
	BTC_USD = util.getJSON("https://blockchain.info/ticker")['USD']['15m']
	
	output = {
		"secondsLeft":util.getTimeLeft(startDate),
		"address":address,
		"final_balance":data['final_balance'],
		"BTC_USD": BTC_USD,
		"raw": data
	}

	return json.dumps(output)
Ejemplo n.º 5
0
def getTargetAddress():
    address = PotAddress.getCurrentAddress(startDate)
    data = PotAddress.getData(address)

    # current value of BTC in USD
    BTC_USD = util.getJSON("https://blockchain.info/ticker")['USD']['15m']

    output = {
        "secondsLeft": util.getTimeLeft(startDate),
        "address": address,
        "final_balance": data['final_balance'],
        "BTC_USD": BTC_USD,
        "raw": data
    }

    return json.dumps(output)