Dhan Http
A class to interact with the DhanHQ APIs using HTTP protocol.
This library provides methods to manage orders, retrieve market data, and perform various trading operations through the DhanHQ API.
:copyright: (c) 2025 by Dhan. :license: see LICENSE for details.
dhanhq.dhan_http
A class to interact with the DhanHQ APIs using HTTP protocol.
This library provides methods to manage orders, retrieve market data, and perform various trading operations through the DhanHQ API.
:copyright: (c) 2025 by Dhan. :license: see LICENSE for details.
Classes
DhanHTTP
DhanHTTP(client_id, access_token, disable_ssl=False, pool=None)
Manages API keys, connection context, and HTTP requests
Classes
HttpMethods
Bases: Enum
Constants for HTTP Requests
HttpResponseStatus
Bases: Enum
Constants for HTTP Status Codes
Functions
delete
delete(endpoint)
Do HTTP-DELETE request to Dhan Endpoint.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
endpoint |
str
|
The endpoint ignoring the base URL. |
required |
Returns: dict: The response in dict format.
get
get(endpoint)
Do HTTP-GET request to Dhan Endpoint.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
endpoint |
str
|
The endpoint ignoring the base URL. |
required |
Returns: dict: The response in dict format.
post
post(endpoint, payload)
Do HTTP-POST request to Dhan Endpoint.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
endpoint |
str
|
The endpoint ignoring the base URL. |
required |
payload |
dict
|
The payload dict contains the data that needs to be sent to the server. |
required |
Returns: dict: The response in dict format.
put
put(endpoint, payload)
Do HTTP-PUT request to Dhan Endpoint.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
endpoint |
str
|
The endpoint ignoring the base URL. |
required |
payload |
dict
|
The payload dict contains the data that needs to be sent to the server. |
required |
Returns: dict: The response in dict format.