Using Upstox sdk 2.0, token method fails since few days. It was working fine earlier.
ValueError: Invalid values for exchanges
[BFO], must be a subset of [NSE, NFO, CDS, BSE, BCD, MCX]
token_response = login_api.token(api_version, code=code, client_id=client_id, client_secret=client_secret, redirect_uri=redirect_uri, grant_type=grant_type)
Token generation fails at the following method.
def exchanges(self, exchanges):
"""Sets the exchanges of this TokenResponse.
Lists the exchanges to which the user has access # noqa: E501
:param exchanges: The exchanges of this TokenResponse. # noqa: E501
:type: list[str]
"""
allowed_values = ["NSE", "NFO", "CDS", "BSE", "BCD", "MCX"] # noqa: E501
if not set(exchanges).issubset(set(allowed_values)):
raise ValueError(
"Invalid values for `exchanges` [{0}], must be a subset of [{1}]" # noqa: E501
.format(", ".join(map(str, set(exchanges) - set(allowed_values))), # noqa: E501
", ".join(map(str, allowed_values)))
)
self._exchanges = exchanges