Skip to content

Commit 41ea4a8

Browse files
authored
Merge pull request #460 from krishnavelu/develop
Develop -> master for 2.0.2
2 parents 0db89c0 + 258484c commit 41ea4a8

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pip --no-cache-dir install --upgrade alice_blue
2929
## Getting started with API
3030

3131
### Overview
32-
There is only one class in the whole library: `AliceBlue`. The `login_and_get_sessioID()` static method is used to retrieve session ID from alice blue server. A session ID is valid for 24 hours.
32+
There is only one class in the whole library: `AliceBlue`. The `login_and_get_sessionID()` static method is used to retrieve session ID from alice blue server. A session ID is valid for 24 hours.
3333
With session ID, you can instantiate an AliceBlue object. Ideally you only need to create a session ID once every day. Once the session ID is created new, it'll be stored in a temporary location. Next time, the same session ID will be used.
3434

3535
### REST Documentation
@@ -47,22 +47,21 @@ logging.basicConfig(level=logging.DEBUG)
4747

4848
### Geting API Id and API secret
4949
api_secret is unique for each and every account. You need to enable api trading and get api_secret from alice blue.
50-
1. Please [contact](https://www.aliceblueonline.com/contact-us/) alice blue to get access to api.
51-
2. After you get a response from alice blue, login to [developer console](http://developers.aliceblueonline.com).
52-
3. Click on 'Create New App'.
53-
4. Enter 'App Name' as you like. Enter 'Redirect URL' and 'Post Back URL' as `https://ant.aliceblueonline.com/plugin/callback`.
54-
5. Click on 'Save'.
55-
6. Copy the 'App Code' and 'App Secret'. You will need these to generate a session ID.
50+
1. Login to [developer console](http://developers.aliceblueonline.com).
51+
1. Click on 'Create New App'.
52+
1. Enter 'App Name' as you like. Enter 'Redirect URL' and 'Post Back URL' as `https://ant.aliceblueonline.com/plugin/callback`.
53+
1. Click on 'Save'.
54+
1. Copy the 'App Code' and 'App Secret'. You will need these to generate a session ID.
5655

5756
### Getting an session ID
5857
1. Import alice_blue
5958
```python
6059
from alice_blue import *
6160
```
6261

63-
2. Create `session_id` using `login_and_get_sessioID()` function with your `username`, `password`, `2FA (2fa is now year of birth)`, `app_id` and `api_secret`.
62+
2. Create `session_id` using `login_and_get_sessionID()` function with your `username`, `password`, `2FA (2fa is now year of birth)`, `app_id` and `api_secret`.
6463
```python
65-
session_id = AliceBlue.login_and_get_sessioID( username = "username",
64+
session_id = AliceBlue.login_and_get_sessionID( username = "username",
6665
password = "password",
6766
twoFA = "1993",
6867
app_id = "app_id",

alice_blue/alice_blue.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,12 +165,12 @@ def __init__(self, username, session_id, master_contracts_to_download = None):
165165
self.ws_thread = None
166166

167167
@staticmethod
168-
def login_and_get_sessioID(username, password, twoFA, app_id, api_secret):
168+
def login_and_get_sessionID(username, password, twoFA, app_id, api_secret):
169169
""" Login and get Session ID """
170170
header = {"Content-Type" : "application/json"}
171171
try:
172172
dr = tempfile.gettempdir()
173-
tmp_file = os.path.join(dr, "alice_blue_key_SP22017.json")
173+
tmp_file = os.path.join(dr, f"alice_blue_key_{username}.json")
174174
if(os.path.isfile(tmp_file) == True):
175175
d = {}
176176
with open(tmp_file, 'r') as fo:
@@ -199,6 +199,7 @@ def login_and_get_sessioID(username, password, twoFA, app_id, api_secret):
199199

200200
# Web Login
201201
checksum = CryptoJsAES.encrypt(password.encode(), encKey.encode())
202+
checksum = checksum.decode("utf-8")
202203
data = {"userId" : username,
203204
"userData" : checksum}
204205
r = requests.post(AliceBlue.__urls["webLogin"], json=data)

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
requests
1+
cryptography
22
pytz
3+
requests
34
websocket_client
4-
cryptography

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@
66
setuptools.setup(
77
name = 'alice_blue',
88
packages=setuptools.find_packages(),
9-
version = '2.0.1',
9+
version = '2.0.2',
1010
include_package_data=True,
1111
description = 'Official Python library for Alice Blue APIs',
1212
long_description=long_description,
1313
long_description_content_type="text/markdown", author = 'Krishna Velu',
1414
author_email = 'krishnajvelu@gmail.com',
1515
url = 'https://github.com/krishnavelu/alice_blue',
16-
install_requires=['requests', 'websocket_client', 'bs4'],
16+
install_requires=['cryptography', 'pytz', 'requests', 'websocket_client'],
1717
keywords = ['alice', 'alice-blue', 'python', 'sdk', 'trading', 'stock markets'],
1818
python_requires='>=3.6',
1919
classifiers=[

0 commit comments

Comments
 (0)