Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Look-up subscriber ID from RMN using tata sky API #48

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion code_samples/allChannels.json

Large diffs are not rendered by default.

33 changes: 30 additions & 3 deletions code_samples/main.py
@@ -1,6 +1,7 @@
import login
import utils
import jwtoken as jwt
import requests

while True:
try:
Expand All @@ -23,19 +24,45 @@
print("4. Exit")
print("*************************************************************")
print("\n")
ch = int(input("Enter your choice:"))
try:
ch = int(input("Enter your choice:"))
except (EOFError, KeyboardInterrupt):
print("")
ch = 4

if ch == 1:
rmn = str(input("Enter your Registered Mobile Number without the country code: "))
sid = str(input("Enter your Subscriber Id: "))
try:
r = requests.post('https://tm.tapi.videoready.tv/rest-api/pub/api/v2/subscriberLookup', json={"rmn": rmn}, timeout=10)
resp = r.json()
if resp['code'] != 0: raise ValueError # Usually invalid RMN
sids = [ i['sid'] for i in resp['data']['sidList']]
if len(sids) > 1:
print("Multiple Subscriber IDs found for this RMN:")
print("\n".join(sids))
raise Exception("Need to manually select the SID")
sid = str(input("Enter your Subscriber Id [" + sids[0] + "]: ")) or sids[0]
except:
sid = str(input("Enter your Subscriber Id: "))
pwd = str(input("Enter your password: "))
print("Trying to Login with password ............")
print("\n \n")
print("*************************************")
login.loginWithPass(sid=sid, rmn=rmn, pwd=pwd)
elif ch == 2:
rmn = str(input("Enter your Registered Mobile No without the Country Code: "))
sid = str(input("Enter your Subscriber Id: "))
try:
r = requests.post('https://tm.tapi.videoready.tv/rest-api/pub/api/v2/subscriberLookup', json={"rmn": rmn}, timeout=10)
resp = r.json()
if resp['code'] != 0: raise ValueError # Usually invalid RMN
sids = [ i['sid'] for i in resp['data']['sidList']]
if len(sids) > 1:
print("Multiple Subscriber IDs found for this RMN:")
print("\n".join(sids))
raise Exception("Need to manually select the SID")
sid = str(input("Enter your Subscriber Id [" + sids[0] + "]: ")) or sids[0]
except:
sid = str(input("Enter your Subscriber Id: "))
login.generateOTP(sid=sid, rmn=rmn)
otp = str(input("Enter the OTP sent to your rmn: "))
print("\n \n")
Expand Down