Unofficial Python API Wrapper for Ncell
Project description
📞Unofficial Python API Wrapper for Ncell
This is the unofficial python API wrapper for Ncell application. With this wrapper, you can call almost all functions of the application.
Note: This code is in no way affiliated with, authorized, maintained, sponsored or endorsed by Ncell or any of its affiliates or subsidiaries. This is an independent and unofficial API. Use at your own risk.
Table of Contents
Installation
-
Install via pip.
pip install ncellapp
-
Install from the source.
git clone https://github.com/hemantapkh/ncellapp.git && cd ncellapp && python setup.py install
Quick start guide
Example 1 (Getting a Token)
>>> from ncellapp import register
>>> reg = register('98140*****')
>>> reg.sendOtp() # Send login OTP to the number
{'cacheDataInMins': '0', 'msisdn': '98140*****', 'deviceClientId': '50*3494d-1*9a-42b4-*ffd-217*78866*f6', 'currentDate': '17-Nov-2020 05:11 PM', 'opStatus': '12', 'errorMessage': 'Please use your One Time Password Verification to complete Registration'}
>>> token = reg.getToken()['token'] # Parse the token from the dict
Example 2 (Sending a free SMS)
>>> from ncellapp import ncell
>>> account = ncell(token)
>>> account.login() # Login to the account
{'opStatus': '0', 'errorMessage': 'SUCCESS'}
>>> account.sendFreeSms(980799****, 'Hey there!, I am sending you an SMS with Python!')
{'cacheDataInMins': '0', 'srRefNumber': 'Your message has been sent successfully.', 'currentDate': '17-Nov-2020 05:19 PM', 'opStatus': '0', 'errorMessage': 'SUCCESS', 'identifier': 'SENDSMS'}
Detailed documentation
Note: For every methods calls, it returns the response from the Ncell server in dictionary type.
register
from ncellapp import register
reg = register('your number')
sendOtp
To send OTP messages to the phone number for registration.
reg.sendOtp()
getToken
To get the login token.
reg.getToken(otp)
Args:
otp (int): OTP sent in phone number for registration
ncell
from ncellapp import ncell
account = ncell('token')
login
To login to the account with the token.
account.login()
After the successful login:
account.name
: return the account name
account.accountId
: return the accountID
account.status
: return the account status
account.msidn
: return the account phone number
account.serviceFlag
: return the account service flag (prepaid/postpaid)
account.currentPlan
: return the account current plan
account.secureToken
: return the account secure token
account.hubID
: return the account hubID
account.partyID
: return the account partyID
Note: You must login to the account to use the methods below.
viewProfile
To view the profile of the account.
account.viewProfile()
sendSms
To send SMS to any Ncell numbers using the current data plan.
account.sendSms(destination, message, schedule)
Args:
destination (int): MSIDN of the destination
message (String): Message to send
schedule (int, optional): Schedule a date to send a SMS (Format: YYYYMMDDHHMMSS), eg.20201105124500. Defaults to None.
sendFreeSms
To send free SMS to any Ncell numbers.
account.sendFreeSms(destination, message, schedule)
Args:
destination (int): MSIDN of the destination
message (String): Message to send
schedule (int, optional): Schedule a date to send a SMS (Format: YYYYMMDDHHMMSS), eg.20201105124500. Defaults to None.
viewBalance
To view the current balance of the account.
account.viewBalance()
selfRecharge
To recharge the current account.
account.selfRecharge(rpin)
Args:
rpin (int): 16 digit PIN of the recharge card.
recharge
To send an instant balance to any Ncell numbers.
account.recharge(destination, rpin)
Args:
rpin (int): 16 digit PIN of the recharge card.
rechargeHistory
To view the balance transfer history.
account.rechargeHistory()
balanceTransfer
To transfer an instant balance to any Ncell numbers.
account.balanceTransfer(destination, amount)
Args:
destination (int): MSIDN of the destination
amount (int): Amount of balance to transfer
confirmBalanceTransfer
To confirm the balance transfer.
account.confirmBalanceTransfer(otp)
Args:
otp (int): OTP sent in phone number for confirming the balance transfer
viewTransaction
To view the call history.
account.viewTransaction(transactionsFrom, transactionsTo)
Args:
transactionsFrom (int): Date from a certain time period (Format: YYYYMMDDHHMMSS)
transactionsTo (int): Date to a certain time period (Format: YYYYMMDDHHMMSS)
confirmViewTransaction
To confirm the viewing of the call history.
account.confirmViewTransaction(otp)
Args:
otp (int): OTP sent in phone number for viewing the call history
viewService
To view the list of available services to activate.
account.viewService(serviceCategory)
Args:
serviceCategory (str, optional): Category of the service. Defaults to None.
activateService
To activate the certain service.
account.activateService(serviceId)
Args:
serviceId (int): Service ID
viewOffer
To view the available offer for the account.
account.viewOffer()
activateOffer
To activate the certain offer.
account.activateOffer(offerId)
Args:
offerId (int): offer ID
view3gPlans
To view available plans for 3G.
account.view3gPlans()
Contributing
Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
You can also contribute to this project by creating an issue of bugs and feature requests.
Contributors
Thanks to every contributors who have contributed in this project.
License
Distributed under the MIT License. See LICENSE for more information.
Author/Maintainer: Hemanta Pokharel [✉️ 💬 📺]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.