The error message is as follows:
Traceback (most recent call last):
File "./bitcoin_price.py", line 57, in <module>
Coindesk()
File "./bitcoin_price.py", line 45, in Coindesk
coindesk.pass_for_request()
File "./bitcoin_price.py", line 39, in pass_for_request
get_price = BtcAPI(url, api_id, json_tree)
NameError: name 'url' is not defined
What am I missing, here? I'm guessing it is the coindesk.pass_for_request(), but I can't sort out exactly why the values don't get passed. Also, what is a good way to debug something like this? I'm having a rough time looking inside of the classes to see what is going on.
class Price:
def __init__(self, api_id, url, json_tree):
self.api_id = api_id
self.url = url
self.json_tree = json_tree
def pass_for_request(self):
get_price = BtcAPI(url, api_id, json_tree)
get_price.btc_api_call()
def Coindesk():
coindesk = Price(api_id ="coindesk", url = "https://api.coindesk.com/v1/bpi/currentprice.json", json_tree = "['time']['updated']")
coindesk.pass_for_request()