upstox-python

upstox_client.LoginApi

All URIs are relative to https://api-v2.upstox.com

Method HTTP request Description
authorize GET /login/authorization/dialog Authorize API
logout DELETE /logout Logout
token POST /login/authorization/token Get token API

authorize

authorize(client_id, redirect_uri, api_version, state=state, scope=scope)

Authorize API

This provides details on the login endpoint.

Example

from __future__ import print_function
import time
import upstox_client
from upstox_client.rest import ApiException
from pprint import pprint

# create an instance of the API class
api_instance = upstox_client.LoginApi()
client_id = 'client_id_example' # str | 
redirect_uri = 'redirect_uri_example' # str | 
api_version = 'api_version_example' # str | API Version Header
state = 'state_example' # str |  (optional)
scope = 'scope_example' # str |  (optional)

try:
    # Authorize API
    api_instance.authorize(client_id, redirect_uri, api_version, state=state, scope=scope)
except ApiException as e:
    print("Exception when calling LoginApi->authorize: %s\n" % e)

Parameters

Name Type Description Notes
client_id str    
redirect_uri str    
api_version str API Version Header  
state str   [optional]
scope str   [optional]

Return type

void (empty response body)

Authorization

No authorization required

HTTP request headers

[Back to top] [Back to API list] [Back to Model list] [Back to README]

logout

LogoutResponse logout(api_version)

Logout

Logout

Example

from __future__ import print_function
import time
import upstox_client
from upstox_client.rest import ApiException
from pprint import pprint

# Configure OAuth2 access token for authorization: OAUTH2
configuration = upstox_client.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'

# create an instance of the API class
api_instance = upstox_client.LoginApi(upstox_client.ApiClient(configuration))
api_version = 'api_version_example' # str | API Version Header

try:
    # Logout
    api_response = api_instance.logout(api_version)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling LoginApi->logout: %s\n" % e)

Parameters

Name Type Description Notes
api_version str API Version Header  

Return type

LogoutResponse

Authorization

OAUTH2

HTTP request headers

[Back to top] [Back to API list] [Back to Model list] [Back to README]

token

TokenResponse token(api_version, code=code, client_id=client_id, client_secret=client_secret, redirect_uri=redirect_uri, grant_type=grant_type)

Get token API

This API provides the functionality to obtain opaque token from authorization_code exchange and also provides the user’s profile in the same response.

Example

from __future__ import print_function
import time
import upstox_client
from upstox_client.rest import ApiException
from pprint import pprint

# create an instance of the API class
api_instance = upstox_client.LoginApi()
api_version = 'api_version_example' # str | API Version Header
code = 'code_example' # str |  (optional)
client_id = 'client_id_example' # str |  (optional)
client_secret = 'client_secret_example' # str |  (optional)
redirect_uri = 'redirect_uri_example' # str |  (optional)
grant_type = 'grant_type_example' # str |  (optional)

try:
    # Get token API
    api_response = api_instance.token(api_version, code=code, client_id=client_id, client_secret=client_secret, redirect_uri=redirect_uri, grant_type=grant_type)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling LoginApi->token: %s\n" % e)

Parameters

Name Type Description Notes
api_version str API Version Header  
code str   [optional]
client_id str   [optional]
client_secret str   [optional]
redirect_uri str   [optional]
grant_type str   [optional]

Return type

TokenResponse

Authorization

No authorization required

HTTP request headers

[Back to top] [Back to API list] [Back to Model list] [Back to README]