from future import absolute_import
import upstox_client
from upstox_client.rest import ApiException
from upstox_client.models import IndieUserTokenRequest
import os
CLIENT_ID = “XXXXXXXXXXXXXXXXXXXXXXX”
CLIENT_SECRET = “XXXXXX”
configuration = upstox_client.Configuration()
api_client = upstox_client.ApiClient(configuration)
login_api = upstox_client.LoginApi(api_client)
indie_user_token_request_body = IndieUserTokenRequest(
client_secret=CLIENT_SECRET
)
try:
v3_token_response = login_api.init_token_request_for_indie_user(
body=indie_user_token_request_body,
client_id=CLIENT_ID,
)
print("V3 Token Generation Initiated Successfully!")
print(f"Response: {v3_token_response}")
except ApiException as e:
print(f"Exception when calling LoginApi->init_token_request_for_indie_user: {e}\n")
print(f"Error details: {e.body}“)
print(f"Status code: {e.status}”)
using the above code getting below error
HTTP response headers: HTTPHeaderDict({‘Date’: ‘Sun, 27 Jul 2025 11:40:05 GMT’, ‘Content-Type’: ‘application/json’, ‘Transfer-Encoding’: ‘chunked’, ‘Connection’: ‘keep-alive’, ‘reqid’: ‘300ecf85-a3ee-48bf-970e-5c35278cd834’, ‘vary’: ‘Origin, Access-Control-Request-Method, Access-Control-Request-Headers’, ‘message’: ‘request failed’, ‘requestid’: ‘b269bce6-9eed-488a-ae60-dd8cb6a76de5’, ‘x-content-type-options’: ‘nosniff’, ‘x-xss-protection’: ‘0’, ‘Cache-Control’: ‘no-cache, no-store, max-age=0, must-revalidate’, ‘pragma’: ‘no-cache’, ‘expires’: ‘0’, ‘strict-transport-security’: ‘max-age=0; includeSubDomains’, ‘x-frame-options’: ‘DENY’, ‘cf-cache-status’: ‘DYNAMIC’, ‘Set-Cookie’: ‘__cf_bm=MDWU1a0pOkkf2VOcB7jeEcnYVx1LANRVyYEq6PmIXHc-1753616405-1.0.1.1-WgW6CitnTCvLddZsprbj52ZnVTnxUouQBycpuuQwuZ8UwOdk.hwJdnFqBIBXCWf0; path=/; expires=Sun, 27-Jul-25 12:10:05 GMT; domain=.upstox.com; HttpOnly; Secure; SameSite=None, _cfuvid=PAea4xm3XDboncGjxEGmHHyTDDUmIytel4u39UODn.Q-1753616405221-0.0.1.1-604800000; path=/; domain=.upstox.com; HttpOnly; Secure; SameSite=None’, ‘Server’: ‘cloudflare’, ‘CF-RAY’: ‘965bdc247e410522-BOM’, ‘alt-svc’: ‘h3=“:443”; ma=86400’})
HTTP response body: b’{“status”:“error”,“errors”:[{“errorCode”:“UDAPI1123”,“message”:“Invalid notifier url”,“propertyPath”:null,“invalidValue”:null,“error_code”:“UDAPI1123”,“property_path”:null,“invalid_value”:null}]}’
Error details: b’{“status”:“error”,“errors”:[{“errorCode”:“UDAPI1123”,“message”:“Invalid notifier url”,“propertyPath”:null,“invalidValue”:null,“error_code”:“UDAPI1123”,“property_path”:null,“invalid_value”:null}]}’
Status code: 400