At first you put your returned object into a variable and check the type of the returned value.
just like this:
print type(your_returned object/variable)
If this is dictionary You can access data from a dictionary via dictionary key. A dictionary structure is:
dict = {key_1 : value_1 , key_2 : value_2, ......key_n : value_n}
1.You can access all values of dictionary.
like below:
print dict[key_1] #output will be returned value_1
- Then you can convert returned data to integer or float.
For converting to integer:
int(your_data)
convert to float:
float(your_data)
If it is not a dictionary you need to convert it to a dictionary or json via :
json.loads(your returned object)
In your case you can do:
variable = client.get_spot_price()
print type(variable) #if it is dictionary or not
print float(variable["amount"]) #will return your price in float