q
is a dictionary here which contains following keys.
{'pricebandupper': 1741.2,
'symbol': 'INFY',
'applicableMargin': 14.5,
'bcEndDate': None,
'totalSellQuantity': 2701.0,
'adhocMargin': None,
'companyName': 'Infosys Limited',
'marketType': 'N',
'exDate': '31-MAY-22',
'bcStartDate': None,
'css_status_desc': 'Listed',
'dayHigh': 1604.9,
'basePrice': 1582.95,
'securityVar': 11.0,
'pricebandlower': 1424.7,
'sellQuantity5': None,
'sellQuantity4': None,
'sellQuantity3': None,
'cm_adj_high_dt': '17-JAN-22',
'sellQuantity2': None,
'dayLow': 1585.1,
'sellQuantity1': 2701.0,
'quantityTraded': 4739884.0,
'pChange': 0.51,
'totalTradedValue': 75687.89,
'deliveryToTradedQuantity': 52.28,
'totalBuyQuantity': None,
'averagePrice': 1596.83,
'indexVar': None,
'cm_ffm': 584614.71,
'purpose': 'ANNUAL GENERAL MEETING/DIVIDEND - RS 16 PER SHARE',
'buyPrice2': None,
'secDate': '19-Aug-2022 00:00:00',
'buyPrice1': None,
'high52': 1953.9,
'previousClose': 1582.95,
'ndEndDate': None,
'low52': 1367.15,
'buyPrice4': None,
'buyPrice3': None,
'recordDate': '01-JUN-22',
'deliveryQuantity': 2477938.0,
'buyPrice5': None,
'priceBand': 'No Band',
'extremeLossMargin': 3.5,
'cm_adj_low_dt': '17-JUN-22',
'varMargin': 11.0,
'sellPrice1': 1597.1,
'sellPrice2': None,
'totalTradedVolume': 4739884.0,
'sellPrice3': None,
'sellPrice4': None,
'sellPrice5': None,
'change': 8.05,
'surv_indicator': None,
'ndStartDate': None,
'buyQuantity4': None,
'isExDateFlag': False,
'buyQuantity3': None,
'buyQuantity2': None,
'buyQuantity1': None,
'series': 'EQ',
'faceValue': 5.0,
'buyQuantity5': None,
'closePrice': 1597.1,
'open': 1585.3,
'isinCode': 'INE009A01021',
'lastPrice': 1591.0}
To get the values for the keys you have, you can do this
from nsetools import Nse
nse = Nse()
q = nse.get_quote('infy')
print(list( map(q.get, ["totalBuyQuantity","total SellQuantity"]) ))
which gives you
[None, None]