@admin ,
i tried everything . have install both the libraray as well but still same issue.
also want to confirmone thing - client id and username are same only right??
Posts made by puna123
-
RE: ModuleNotFoundError: No module named 'smartapi'
-
RE: Tick values are refreshing very slowly in websocket streaming.
@J88913 ,
i am getting below error with this code. can you help.{'task': 'hb', 'channel': '', 'token': '093658357', 'user': '', 'acctid': ''}
Error info: 'ltp'
'ltp' -
RE: Tick values are refreshing very slowly in websocket streaming.
@admin
can you please update me on below error? -
RE: how to pass token in authorization for historic api run through postman
@admin ,
i am using below link for login api call to generate the token .is this the correct link?
but what should i passs in header and body?https://apiconnect.angelbroking.com/rest/auth/angelbroking/jwt/v1/generateTokens
-
RE: how to pass token in authorization for historic api run through postman
@admin ,
are you saying about this feed token . shall we pass this token in our api call through postman.??package import statement
from smartapi import SmartConnect #or from smartapi.smartConnect import SmartConnect
#import smartapi.smartExceptions(for smartExceptions)#create object of call
obj=SmartConnect(api_key="*****")
# optional
# access_token = "your access token",
# refresh_token = "your refresh_token")#login api call
data = obj.generateSession("","")
print(data)
refreshToken= data['data']['refreshToken']#fetch the feedtoken
feedToken=obj.getfeedToken()
print(feedToken) -
RE: Tick values are refreshing very slowly in websocket streaming.
@J88913 ,@admin
i got the code from the link you have given but getting below error.
would you be able to help?
Error info: Handshake status 503 Service Unavailable
Handshake status 503 Service Unavailable
Error info: __on_close() takes 2 positional arguments but 4 were given
__on_close() takes 2 positional arguments but 4 were given -
RE: Immediate Action Needed
@bhaveshjain ,
this link is not giving any information . can you check from your side. -
RE: how to pass token in authorization for historic api run through postman
@puna123 can anyone help here plzz
-
RE: I am not seeing websocket streaming code in smartapi documentation.
@admin
I am asking that similar code for websocket streaming api which you have given in historic api page . As I was able to see that code earlier but not now.Can u provide me that streaming code where we navigate the request through conn.request () method....
-
I am not seeing websocket streaming code in smartapi documentation.
i cant see the websocket streaming code in smari api doc.
-
how to pass token in authorization for historic api run through postman
hi ,
i am getting below invalid token error. can anyone help how and what to pass in token. and from where i can get it.
error screenshot attached for reference. -
RE: ModuleNotFoundError: No module named 'smartapi'
hi ,
i am also facing the same issue.import itself doesnt work .can anyone help here plz.
PS C:\Users\Lenovo\Desktop\History Data> & 'C:\Users\Lenovo\AppData\Local\Microsoft\WindowsApps\python.exe' 'c:\Users\Lenovo.vscode\extensions\ms-python.python-2021.9.1246542782\pythonFiles\lib\python\debugpy\launcher' '58178' '--' 'c:\Users\Lenovo\Desktop\History Data\test.py'
Traceback (most recent call last):
File "c:\Users\Lenovo\Desktop\History Data\test.py", line 1, in <module>
from smartapi.smartConnect import SmartConnect
ModuleNotFoundError: No module named 'smartapi'
PS C:\Users\Lenovo\Desktop\History Data> -
RE: getting TypeError: can't concat str to bytes error while executing historic api . plz help
while executing below code. i am getting above error.
import http.client
conn = http.client.HTTPSConnection("apiconnect.angelbroking.com")
payload = {
"exchange": "NSE ",
"symboltoken ": "3045 ",
"interval ": "ONE_MINUTE ",
"fromdate ": "2021 - 02 - 10 09: 15 ",
"todate ": "2021 - 02 - 10 09: 16 "
}
#"{"exchange": "NSE","symboltoken": "3045","interval": "ONE_MINUTE","fromdate": "2021-02-10 09:15","todate": "2021-02-10 09:16"}"
headers = {
'X-PrivateKey': '********',
'Accept': 'application/json',
'X-SourceID': 'WEB',
'X-ClientLocalIP': 'CLIENT_LOCAL_IP',
'X-ClientPublicIP': 'CLIENT_PUBLIC_IP',
'X-MACAddress': 'MAC_ADDRESS',
'X-UserType': 'USER',
'Authorization': 'Bearer AUTHORIZATION_TOKEN',
'Accept': 'application/json',
'X-SourceID': 'WEB',
'Content-Type': 'application/json'
}
conn.request("POST", "/rest/secure/angelbroking/historical/v1/getCandleData", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8")) -
getting TypeError: can't concat str to bytes error while executing historic api . plz help
TypeError Traceback (most recent call last)
<ipython-input-11-bab6b51f7b98> in <module>
23 'Content-Type': 'application/json'
24 }
---> 25 conn.request("POST", "/rest/secure/angelbroking/historical/v1/getCandleData", payload, headers)
26 res = conn.getresponse()
27 data = res.read()~\anaconda3\lib\http\client.py in request(self, method, url, body, headers, encode_chunked)
1250 encode_chunked=False):
1251 """Send a complete request to the server."""
-> 1252 self._send_request(method, url, body, headers, encode_chunked)
1253
1254 def _send_request(self, method, url, body, headers, encode_chunked):~\anaconda3\lib\http\client.py in _send_request(self, method, url, body, headers, encode_chunked)
1296 # default charset of iso-8859-1.
1297 body = _encode(body, 'body')
-> 1298 self.endheaders(body, encode_chunked=encode_chunked)
1299
1300 def getresponse(self):~\anaconda3\lib\http\client.py in endheaders(self, message_body, encode_chunked)
1245 else:
1246 raise CannotSendHeader()
-> 1247 self._send_output(message_body, encode_chunked=encode_chunked)
1248
1249 def request(self, method, url, body=None, headers={}, *,~\anaconda3\lib\http\client.py in _send_output(self, message_body, encode_chunked)
1062 # chunked encoding
1063 chunk = f'{len(chunk):X}\r\n'.encode('ascii') + chunk
-> 1064 + b'\r\n'
1065 self.send(chunk)
1066TypeError: can't concat str to bytes