Package: greensms
greensms-pythonDocumentationThe documentation for the GREENSMS API can be foundhere.InstallationpipenvinstallgreensmsorpipinstallgreensmsSample UsageCheck out thesecode examplesto get up and running quickly.fromgreensms.clientimportGreenSMS# Register at my.greensms.ru firstclient=GreenSMS(user='test',password='test')response=client.sms.send(to='71231234567',txt='Message to deliver')print(response.request_id)# or print(response['request_id'])Environment Variablesgreensms-pythonsupports credential storage in environment variables. If no credentials are provided following env vars will be used:GREENSMS_USER/GREENSMS_PASSORGREENSMS_TOKEN.Token Authfromgreensms.clientimportGreenSMS# Register at my.greensms.ru firstclient=GreenSMS(token='yourtoken')response=client.account.balance()print(response.balance)Compatibilitygreensms-pythonis compatible with Python 2.7 and Python 3.4 onwards until the latest Python 3.11 versionMethodsYou can either use username/password combination or auth token to create an object with constructorAll methods support named **kwargsEach API Function is available asMODULE.FUNCTION()Parameters for each API can be referred fromhereResponse keys can be used as dictionary keysresponse['key']or propertiesresponse.keyResponse keys by default are available insnake_case. If you want to usecamelCase, then passuse_camel_case=true, in the constructorHandling ExceptionsExceptions for all APIs are thrown withRestErrorclass. It extends the default Python Exception class.Each error, will haveerror,code,message,errorTypefields.In case ofValidation Error, additional params are available to show field-wise rule failures. Can be accessed bye.paramsproperty on the error objectGetting helpIf you need help installing or using the library, please contact us:support@greensms.ru.If you've instead found a bug in the library or would like new features added, go ahead and open issues or pull requests against this repo!ContributingBug fixes, docs, and library improvements are always welcome. Please refer to ourContributing Guidefor detailed information on how you can contribute.
If you're not familiar with the GitHub pull request/contribution process,this is a nice tutorial.Getting StartedIf you want to familiarize yourself with the project, you can start byforking the repositoryandcloning it in your local development environment. The project requiresNode.jsto be installed on your machine.After cloning the repository, install the dependencies by running the following command in the directory of your cloned repository:pipinstall-rrequirements.txtIn addition to this, we recommend running the setup withvirtualenv, for creating an isolated Python development environment.GreenSMS has all the unit tests defined undertestsfolder with_test.pyextension. Although it uses Python Unittest, we recommended that you test withpy.test. PyTest supports Python unit tests out of the box and is faster for running the tests in bulk.pytesttestsWe also supporttoxfor automate env/interpretor wise testing. Support versions are added to tox.ini. Dependencies added in root requirements.txt are supposed to be added totests/requirements.txtas well.You can install and run tox for the project with the following commands.pipinstalltox# Install toxtox# Run test