{ "info": { "author": "baseIT", "author_email": "baseit.app+asms@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable" ], "description": "==============\r\nasms 1.0.1\r\n==============\r\n\r\nThe **asms** module provides functionality of SMS sending and receiving via\r\nmobile phone. To be more specific, **asms** module act as a client of mobile\r\napplication **aText** (http://baseit.pl/?s=product-atext), running on mobile \r\nphone connected through WiFi to the same local network as machine running \r\nPython script.\r\n\r\n.. contents::\r\n :depth: 2\r\n \r\nDependencies\r\n------------\r\n\r\n\t- Module `enum34 `_ \r\n\t for installations targeted to Python version below 3.4,\r\n\t \r\n\t- There are no dependencies for installations targeted to Python 3.4 and above.\r\n\t\r\n\t- Installation of module \r\n\t `netifaces `_ is recommended. \r\n\t This module is used when available.\t\r\n\r\n\t \r\nOverview\r\n--------\r\n\r\n\tModule provides SMS interface, enabling scripts to send and receiving text\r\n\tmessages (SMSes) via mobile application aText. The aText application must\r\n\tbe running on the mobile phone (under Android), which is connected to the\r\n\tsame WLAN (WiFi) as machine that runs Python script using asms module.\r\n\t\r\n\tText messages are actually sent and received by aText mobile application\r\n\t(http://baseit.pl/?s=product-atext) running on user's mobile phone and \r\n\ttherefore all related fees are charged by a telecommunications operator,\r\n\twhich provides services to the user. Neither program texting nor mobile\r\n\tapplication aText interfere with billing or rating of text messages by \r\n\tthe telco operator. In other words, sending or receiving a text message\r\n\tusing program texting and via mobile application aText, should cost the\r\n\tsame as sending or receiving a similar text message directly on user's\r\n\tmobile phone.\r\n\t\r\n\tMobile application aText (available under commercial, separate license) can\r\n\tbe obtained here: http://baseit.pl/?s=dload-atext\r\n\t\r\n\tAndroid is a trademark of Google Inc.\r\n\t\r\n.. note::\r\n\tAlthough network communication between asms module and mobile\r\n\tapplication aText is encrypted (SSL), this software is NOT intended to be\r\n\tused for applications requiring a high level of security, therefore please\r\n\tdo NOT use this software for such kind of applications (e.g. for banking,\r\n\tetc.). Sent text messages are not encrypted, i.e. text messages are sent\r\n\tfrom a mobile application aText in the same way as directly from the mobile\r\n\tphone.\r\n\r\n\t\r\nDownloading and installation\r\n----------------------------\r\n\r\nThe recommended way of the module downloading and installation is to use pip\r\n(assuming version of default Python instance >= 3.2), as in the following\r\nexample:\r\n\r\n.. code-block:: bash\r\n\t\r\n\t$ python -V\r\n\tPython 3.4.3\r\n\t$ pip install asms\r\n\t\r\nModule installation package can be also downloaded from: http://baseit.pl/?s=product-asms\r\nand installed:\r\n\r\n.. code-block:: bash\r\n\t\r\n\t$ python -V\r\n\tPython 3.4.3\r\n\t$ pip install asms-1.0.1-py3-none-any.whl\r\n\t$ pip install asms-1.0.1.zip\r\n\r\n\t\r\nHow to use - quick start\r\n------------------------\r\n\r\nModule asms needs only two basic parameters to send or receive SMSes:\r\n\r\n\t- password (the same as set in set for mobile application aText).\r\n\t\t Password may be provided as parameter during instantiation of \r\n\t\t asms.SMS class or as asms. ENV_PASS_VARIABLE environment \r\n\t\t variable (\"SMSPASS\"), and\r\n\t\t \r\n\t- own phone number (number of mobile phone running application aText).\r\n\t\t Own phone number may be provided as parameter during instantiation of\r\n\t\t asms.SMS class or as asms. ENV_PHONE_VARIABLE environment variable\r\n\t\t (\"SMSPHONE\").\r\n\t\r\nThe asms module broadcasts LAN and automatically finds mobile phones running \r\naText application connected to the same LAN segment through WiFi, and set up \r\nfor the same \"own phone number\". Note, that only one aText application with\r\nthe given \"own phone number\" can be active in the local network segment. \r\n\r\nMost of work is performed by asms.SMS class in the following, typical steps:\r\n\r\n\t1. Instantiate the class:\r\n\t\t.. code-block:: python\r\n\t\t\r\n\t\t\tclient = asms.SMS(own_phone, password)\r\n\t2. Find mobile phone running application aText:\r\n\t\t.. code-block:: python\r\n\t\t\r\n\t\t if client.find_server():\r\n\t3. If server has been found, then we can connect to the aText application:\r\n\t\t.. code-block:: python\r\n\t\t\r\n\t\t client.connect_to_server()\r\n\t4. Now, we can send SMS:\r\n\t\t.. code-block:: python\r\n\t\t\r\n\t\t response = client.send_sms(recipient_phone, message)\r\n\t5. ... and / or receive SMS-es (if any):\r\n\t\t.. code-block:: python\r\n\t\t\r\n\t\t response = client.check_sms()\r\n\t\t if response.is_confirmed():\r\n\t\t\t print(response.get_sms_message())\r\n\t6. Close connection:\r\n\t\t.. code-block:: python\r\n\t\t\r\n\t\t client.close_server_connection()\r\n\r\n\t\t \r\nBasic usage pattern - sending SMS\r\n=================================\r\n\r\nBelow you can find complete, basic sample of sending SMS using asms module:\r\n\r\n.. code-block:: python\r\n\r\n\timport asms\r\n\timport sys\r\n\r\n\tOWN_PHONE_NUMBER = \"...\"\r\n\tATEXT_APPLICATION_PASSWORD = \"...\"\r\n\tRECIPIENT_PHONE_NUMBER = \"...\"\r\n\tMESSAGE_TO_SEND = 'Hello World!'\r\n\r\n\tclient = None\r\n\ttry:\r\n\t\tclient = asms.SMS(phone = OWN_PHONE_NUMBER, password = ATEXT_APPLICATION_PASSWORD)\r\n\t\tif client.find_server():\r\n\t\t\tprint(\"Found aText server: {}.\".format(client.get_server_address()))\r\n\t\telse:\r\n\t\t\tprint(\"Cannot find aText server in the local network. Exiting.\", file = sys.stderr)\r\n\t\t\texit(1)\r\n\r\n\t\tclient.connect_to_server()\r\n\r\n\t\tresponse = client.send_sms(RECIPIENT_PHONE_NUMBER, MESSAGE_TO_SEND)\r\n\t\tif response.is_confirmed():\r\n\t\t\tprint(\"OK: {}.\".format(response.get_message()))\r\n\t\telse:\r\n\t\t\tprint(\"Text sending error({}): {}\".format(response.get_code().value, response.get_message()), file = sys.stderr)\r\n\t\t\t\t \r\n\texcept Exception as e:\r\n\t\tprint(\"Execution error: {}.\".format(e), file = sys.stderr)\r\n\t\texit(1)\r\n\tfinally: \r\n\t\tif not client is None:\r\n\t\t\tclient.close_server_connection()\r\n\r\n\texit(0)\r\n\t\r\n\t\r\nBasic usage pattern - reading SMS(es)\r\n=====================================\r\n\r\nBelow you can find template code of complete, basic sample of receiving\r\nSMS using asms module. \r\n\r\nThis sample is based on assumption that own phone number and password are\r\nset in environment variables: **SMSPHONE** and **SMSPASS** respectively.\r\n\r\n.. code-block:: python\r\n\r\n import asms\r\n import sys\r\n\r\n client = None\r\n try:\r\n client = asms.SMS()\r\n if client.find_server():\r\n print(\"Found aText server: {}.\".format(client.get_server_address()))\r\n else:\r\n print(\"Cannot find aText server in the local network. Exiting.\", file = sys.stderr)\r\n exit(1)\r\n\r\n client.connect_to_server()\r\n \r\n while True:\r\n r = client.check_sms()\r\n if r.is_confirmed():\r\n if r.has_contact_name():\r\n sender = \"{} ({})\".format(r.get_contact_name(), r.get_sent_from())\r\n else:\r\n sender = r.get_sent_from()\r\n print(\"Text from {} sent at {}, and received at {}\".format(sender, r.get_smsc_time(),r.get_receive_time()))\r\n print(r.get_sms_message())\r\n elif response.is_rejected():\r\n break\r\n else:\r\n print(\"Text receiving error({}): {}\".format(response.get_code().value, response.get_message), file = sys.stderr)\r\n except Exception as e:\r\n print(\"Execution error: {}.\".format(e), file = sys.stderr)\r\n exit(1)\r\n finally: \r\n if not client is None:\r\n client.close_server_connection()\r\n\r\n exit(0)\r\n\r\n\t\r\nUsing the asms Module\r\n---------------------\r\n\r\nasms Constants\r\n==============\r\n\r\nasms.ENV_PASS_VARIABLE = \"SMSPASS\"\r\n##################################\r\n\tName of the environment variable which is expected to provide password, \r\n\tif not set as parameter during instantiation of asms.SMS class.\r\n\t\r\nasms.ENV_PHONE_VARIABLE = \"SMSPHONE\"\r\n####################################\r\n\tName of the environment variable which is expected to provide own phone number,\r\n\tif not set as parameter during instantiation of asms.SMS class.\r\n\r\nasms Exceptions\r\n===============\r\n\r\n*exception* asms.IllegalArgumentError\r\n#####################################\r\n\tA subclass of ValueError raised when method is invoked with invalid arguments.\r\n\tFor example exception asms.IllegalArgumentError is raised when invalid phone\r\n\tnumber is passed as parameter to asms.SMS class.\r\n \r\n*exception* asms.IllegalStateError\r\n##################################\r\n\tA subclass of ValueError raised when state of the module and / or environment\r\n\tprohibits further processing. For example asms.IllegalStateError is raised\r\n\tif asms.get_own_ip function cannot determine own ip address.\r\n\r\n*exception* asms.SecurityException\r\n##################################\r\n\tRaised when application security is violated, for example when provided\r\n\tpassword is rejected by aText mobile application for given own phone number.\r\n\r\n*exception* asms.TooManyServersFound(SecurityException)\r\n#######################################################\r\n\tA subclass of SecurityException raised when more than one valid aText mobile\r\n\tapplication is detected for given own phone number.\r\n\r\nasms Classes\r\n============\r\n\r\n*class* asms.ServerResponseCode\r\n###############################\r\n\r\nEnum class providing values of possible SMS server (aText application)\r\nresponse codes:\r\n\r\n- confirmed\r\n\t means, that server confirmed the request (e.g. SMS has been sent),\r\n\t \r\n- rejected\r\n\t means, that server rejected the request (e.g. there is no more SMS-es\r\n\t to read),\r\n\t \r\n- error\r\n\t means, that the request has not been performed and server reports error.\r\n\r\n\t\t \r\n*class* asms.ServerResponse\r\n###########################\r\n\r\nThe ServerResponse class provides server (aText application) response and\r\ninformation, such as response code (*get_code()*) and \r\nserver message (*get_message()*) describing response.\r\n\r\nget_code()\r\n^^^^^^^^^^\r\n\tReturns actual response code as an instance of \r\n\tasms.ServerResponseCode class.\r\n\t\r\nget_message()\r\n^^^^^^^^^^^^^\r\n\tReturns additional text describing response as returned from\r\n\tthe server (aText application).\r\n\t\r\n\tInstead of using get_code() one should use methods: \r\n\tis_confirmed(), is_rejected(), is_error()\r\n\r\nis_confirmed()\r\n^^^^^^^^^^^^^^\r\n\tReturns True if get_code() == asms.ServerResponseCode.confirmed\r\n\r\nis_rejected()\r\n^^^^^^^^^^^^^\r\n\tReturns True if get_code() == asms.ServerResponseCode.rejected\r\n\r\nis_error()\r\n^^^^^^^^^^\r\n\tReturns True if get_code() == asms.ServerResponseCode.error\r\n\tWhen reading SMS-es (instance of asms.ServerResponce class is returned \r\n\tfrom the check_sms method of the SMS class object) the following\r\n\tmethods can be used:\r\n\r\nhas_sms_message()\r\n^^^^^^^^^^^^^^^^^\r\n\tReturns True if response contains text of SMS message.\r\n\t\r\nget_sms_message()\r\n^^^^^^^^^^^^^^^^^\r\n\tReturns text of SMS message.\r\n\t\r\nhas_sent_from()\r\n^^^^^^^^^^^^^^^\r\n\tReturns True if response contains phone number of the sender of the\r\n\tSMS message.\r\n\t\r\nget_sent_from()\r\n^^^^^^^^^^^^^^^\r\n\tReturns phone number of the sender of the SMS message.\r\n\t\r\nhas_smsc_time()\r\n^^^^^^^^^^^^^^^\r\n\tReturns True if response contains timestamp when the SMS was registered\r\n\tby the telco operator, i.e.in the SMSC (SMS Center).\r\n\t\r\nget_smsc_time()\r\n^^^^^^^^^^^^^^^\r\n\tReturns timestamp when the SMS was registered by the telco operator,\r\n\ti.e.in the SMSC (SMS Center).\r\n\t\r\nhas_receive_time()\r\n^^^^^^^^^^^^^^^^^^\r\n\tReturns True if response contains timestamp when the SMS was received\r\n\tby the mobile phone (aText application).\r\n\t\r\nget_receive_time()\r\n^^^^^^^^^^^^^^^^^^\r\n\tReturns timestamp when the SMS was received by the mobile phone\r\n\t(aText application).\r\n\r\n\t\r\nAdditionally, one can check if server returned contact name of the\r\nSMS peer phone number basing on mobile phone contacts directory.\r\n\t\r\nhas_contact_name()\r\n^^^^^^^^^^^^^^^^^^\r\n\tReturns True if response contains contact name of the SMS\r\n\tpeer (sender when receiving SMS or recipient when sending SMS).\r\n\tContact name is retrieved from the contacts directory of\r\n\tmobile phone used.\r\n\t\r\nget_contact_name()\r\n^^^^^^^^^^^^^^^^^^\r\n\tReturns contact name of the SMS peer (sender when receiving SMS\r\n\tor recipient when sending SMS) as provided by the server\r\n\t(application aText). Contact name is retrieved from the contacts\r\n\tdirectory of mobile phone used.\r\n\r\n\t\r\n*class* asms.SMS\r\n################\r\n\r\nThe SMS client class providing interface to send and receive text messages\r\n(SMS-es).\r\n\r\nasms.SMS(phone = None, password = None, own_ip_address = None, own_ip_netmask = None, server_address = None, udp_wait_time = 1, port_udp = 1410, port_tcp = 1410, max_server_finding_attempts = 16, verbose_file = sys.stderr, verbosity = 0)\r\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n\tCreates a new SMS client. \r\n\tAlthough all of parameters are optional, providing \r\n\t**phone** and **password** values is strongly recommended.\r\n\t\t\t\r\n\tphone = None\r\n\t\tOwn phone number, i.e. phone number of the user's mobile phone on which\r\n\t\taText mobile application is running and which will be used actually to\r\n\t\tsend text messages (SMS-es) from. Default value is None which instruct\r\n\t\tthe SMS client to attempt retrieving actual own phone number from\r\n\t\tenvironment variable **SMSPHONE**.\r\n\t\r\n\tpassword = None\r\n\t\tPassword of aText mobile application. Default value is None which\r\n\t\tinstruct the SMS client to attempt retrieving actual own phone number\r\n\t\tfrom environment variable **SMSPASS**.\r\n\t\t\r\n\town_ip_address = None\r\n\t\tOwn IPv4 address of the network interface which should be used to\r\n\t\tcommunicate to the mobile phone (aText mobile application) through\r\n\t\tWLAN / WiFi network. Default value None means that own IPv4 address\r\n\t\tis determined by the SMS client. If own_ip_address parameter\r\n\t\tis provided in CIDR notation (e.g. '192.100.100.100/24' for netmask\r\n\t\t'255.255.255.0'), then own_ip_netmask is determined basing on network\r\n\t\tpart of the address.\r\n\t\t\r\n\town_ip_netmask = None\r\n\t\tOwn IPV4 network mask. Can be provide provided in both dot-decimal\r\n\t\tand bits number format (e.g. '255.255.255.0' and 24 respectively).\r\n\t\tDefault value None means that own IPv4 network mask is determined by\r\n\t\tthe SMS client:\t\r\n\r\n\t\t- if own_ip_address is provided in CIDR notation and contains\r\n\t\t network part (e.g. 24 for '192.100.100.100/24') then network\r\n\t\t part is used to compute network mask;\r\n\t\t \r\n\t\t- else if module netifaces is installed and available then actual\r\n\t\t network mask is retrieved using netifaces;\r\n\t\t \r\n\t\t- else value 24 is assumed (i.e. network mask: '255.255.255.0').\r\n\t\t\t\r\n\t\tSkipping this parameter (or providing None value) is recommended,\r\n\t\tIf netinet module is installed and available.\r\n\r\n\tserver_address = None\t\r\n\t\tIf mobile phone (aText mobile application) IPv4 WiFi address is known\r\n\t\tand fixed, then it can be used to avoid broadcast and skip searching\r\n\t\tof the mobile phone in the local network. Default value None directs\r\n\t\tSMS client to search for mobile phone running aText application in\r\n\t\tthe local network.\r\n\t\r\n\tudp_wait_time = 1\r\n\t\tNumber of seconds to wait for mobile phone answer during basic attempt\r\n\t\tof local network searching.\r\n\t\t\r\n\tport_udp = 1410\r\n\t\tUDP port used. Parameter should NOT be used nor changed in the current\r\n\t\tversion (1.0.1) of the asms module.\r\n\t\t\r\n\tport_tcp = 1410\r\n\t\tTCP port used. Parameter should NOT be used nor changed in the current\r\n\t\tversion (1.0.1) of the asms module.\r\n\t\t\r\n\tmax_server_finding_attempts = 16\r\n\t\tHow many finding attempts should the asms modul to take before\r\n\t\tgiving up.\r\n\t\t\r\n\tverbose_file = sys.stderr\r\n\t\tWhere output of SMS client messages should be directed.\r\n\t\t\r\n\tverbosity = 0\r\n\t\tLevel of SMS client verbosity. Default value 0 means minimal\r\n\t\tlevel of verbosity (no messages at all). Maximum value is 3.\r\n\t\r\n\t\r\nconnect_to_server()\r\n^^^^^^^^^^^^^^^^^^^\r\n\tConnects SMS client to the server (mobile phone on which aText mobile\r\n\tapplication is running). Raises SecurityException if server rejects\r\n\tconnection because of invalid password. \r\n\tAppropriate socket.error / OSError can be raised in case occurrence\r\n\tof network communication problems.\r\n\r\nsend_sms(send_to, text)\r\n^^^^^^^^^^^^^^^^^^^^^^^\r\n\tSends text as SMS (text message) to send_to phone number.\r\n\tReturns response as object of asms.ServerResponse class.\r\n\tIf SMS is successfully sent then response.is_confirmed() == True. \r\n\tAppropriate socket.error / OSError can be raised in case occurrence\r\n\tof network communication problems.\r\n\r\ncheck_sms()\r\n^^^^^^^^^^^\r\n\tReads SMS (text message) if available in the mobile phone \r\n\t(on which aText mobile application is running). \r\n\tReturns response as object of asms.ServerResponse class. \r\n\tIf SMS is read then response.is_confirmed() == True. \r\n\tIf no more SMS messages are available to be read \r\n\tthen response.is_rejected() == True. \r\n\tAppropriate socket.error / OSError can be raised in case occurrence\r\n\tof network communication problems.\r\n\r\nfind_server()\r\n^^^^^^^^^^^^^\r\n\tFind server (mobile phone on which aText mobile application is running)\r\n\tin the local network. \r\n\tReturns True if mobile phone is found, False otherwise.\r\n\r\nclose_server_connection()\r\n^^^^^^^^^^^^^^^^^^^^^^^^^\r\n\tCloses network connection to server (mobile phone on which \r\n\taText mobile application is running). \r\n\t\r\n\tThis method should be be invoked from within finally clause of\r\n\tthe try block enclosing SMS client construction, \r\n\tconnection and interaction:\r\n\t\r\n\t.. code-block:: python\r\n\r\n\t\timport sys\r\n\t\timport asms\r\n\t\t\r\n\t\tclient = None\r\n\t\ttry:\r\n\t\t\tclient = asms.SMS()\r\n\t\t\tif client.find_server():\r\n\t\t\t\tclient.connect_to_server()\r\n\t\t\t\twhile True:\r\n\t\t\t\t\tr = client.check_sms()\r\n\t\t\t\t\tif r.is_confirmed():\r\n\t\t\t\t\t\tprint(r.get_sms_message())\r\n\t\texcept Exception as e:\r\n\t\t\tprint(\"Execution error: {}.\".format(e), file = sys.stderr)\r\n\t\t\texit(1)\r\n\t\tfinally: \r\n\t\t\tif not client is None:\r\n\t\t\t\tclient.close_server_connection()\r\n\t\t\t\t\r\nget_own_ip()\r\n^^^^^^^^^^^^\r\n\tReturns own IPv4 address.\r\n\t\r\nget_own_phone()\r\n^^^^^^^^^^^^^^^\r\n\tReturns own phone, i.e. phone number of the user's mobile phone on\r\n\twhich aText mobile application is running and which will be used\r\n\tactually to send text messages (SMS-es) from.\r\n\t\r\nget_server_address()\r\n^^^^^^^^^^^^^^^^^^^^\r\n\tReturn server (mobile phone on which aText mobile application is\r\n\trunning) IPv4 address if is already known or None.\r\n\t\t\r\nasms Functions\r\n==============\r\n\r\nasms.get_version()\r\n##################\r\n\r\n\tReturns version of the asms module, i.e. string '1.0.1' \r\n\tfor the current version.\r\n\r\nasms.get_build_date()\r\n#####################\r\n\r\n\tReturns string contains build date of the module (i.e. string '2016.01.17 14:54:38') \r\n\tfor the current build.\r\n\t\r\n\t\r\nasms.using_netifaces()\r\n######################\r\n\r\n\tReturns True if **netifaces** module is installed in the user's\r\n\tenvironment and is imported and can be used.\r\n\t\r\n\t\r\nasms.get_main_network_interface_id()\r\n####################################\r\n\r\n\tIf netifaces module is installed returns main network interface id\r\n\t(e.g. 'eth0'), otherwise returns None. \r\n\tHelper function which is used internally by the module.\r\n\t\r\n\t\r\nasms.get_main_network_interface()\r\n#################################\r\n\r\n\tIf netifaces module is installed main returns main network interface\r\n\t(as defined by netifaces), otherwise returns None. \r\n\tHelper function which is used internally by the module.\r\n\t\r\n\t\r\nasms.retrieve_own_ip()\r\n######################\r\n\r\n\tReturns IPv4 address (in dot-decimal notation) of the given machine. \r\n\tIf netifaces module is installed and available then ip address of the main\r\n\tinterface is returned, otherwise for computer with more than one network\r\n\tinterface, this function should return address of one of interfaces which\r\n\tprovides connection to the Internet. \r\n\tRaises exception IllegalStateError if own IPv4 address cannot be \r\n\tdetermined. Helper function which is used internally by the module.\r\n\t\r\n\t\r\nasms.retrieve_own_netmask()\r\n###########################\r\n\r\n\tIf netifaces module is installed and available, returns own network mask \r\n\t(in dot-decimal notation) of the given machine. Otherwise returns None. \r\n\tHelper function which is used internally by the module.\r\n\r\n\r\nasms.retrieve_own_gateway()\r\n###########################\r\n\r\n\tIf netifaces module is installed and available, returns own IPv4 address\r\n\tof default gateway (in dot-decimal notation) of the given machine. \r\n\tOtherwise returns None. \r\n\tHelper function which is used internally by the module.\r\n\t\r\n\t\r\nasms.netmask2ip(netmask_bits)\r\n#############################\r\n\r\n\tConverts number of bits specified in netmask_bits parameter to network mask\r\n\twith leftmost netmask_bits set to b'1' and returns IPv4 network mask in\r\n\tdot-decimal notation (e.g.'255.255.255.0' for netmask_bits == 24). \r\n\tRaises IllegalArgumentError exception if netmask_bits value is \r\n\tout of range <1, 31>. \r\n\tHelper function which is used internally by the module. \r\n\t\r\n\t\r\nasms.ip2b(dot_address)\r\n######################\r\n\r\n\tConverts IPv4 address from dot-decimal notation (e.g.\"192.100.100.100\") \r\n\tto binary integer. Returns IPV4 address in binary, integer format. \r\n\tHelper function which is used internally by the module. \r\n\t\r\n\t\r\nasms.b2ip(bin_address)\r\n######################\r\n\r\n\tConverts IPv4 address from binary integer to dot-decimal notation \r\n\t(e.g.\"8.8.8.8\"). Returns IPV4 address in dot-decimal notation. \r\n\tHelper function which is used internally by the module.\r\n\t\r\n\t\r\nasms.all_network_ip_addresses(dot_ip, dot_netmask)\r\n##################################################\r\n\r\n\tReturns list of all valid IPv4 addresses of the given IPv4 subnetwork. \r\n\tSubnetwork is computed basing on IPv4 address (dot_ip) and network mask\r\n\t(dot_netmask) which must be provided in dot-decimal notation. \r\n\tHelper function which is used internally by the module.\r\n\r\nSample script\r\n-------------\r\n\r\nsms.py\r\n======\r\nThe sms.py is a sample script designated as utility to send and receive \r\nSMS messages using API provided by the **asms** module. This script can\r\nbe examined as recommended sample of the asms module usage for sending\r\nand receiving text messages.\r\n\r\nScript Usage:\r\n\r\n.. code-block:: bash\r\n\r\n\t$ sms.py -h\t\r\n\t\r\n\tusage: sms.py [-h] [-o SENDER_PHONE] [-p PASSWORD] [-m ADDRESSEE_MOBILE | -r]\r\n\t\t\t\t [-v [LEVEL]] [-s SERVER] [-w WAIT] [--version]\r\n\t\t\t\t [TEXT_WORD [TEXT_WORD ...]]\r\n\r\n\tSMS client designated to send text messages through aText mobile application.\r\n\r\n\tpositional arguments:\r\n\t TEXT_WORD words of text message to send\r\n\r\n\toptional arguments:\r\n\t -h, --help show this help message and exit\r\n\t -o SENDER_PHONE, --own-mobile SENDER_PHONE, --from SENDER_PHONE, --send-from SENDER_PHONE\r\n\t\t\t\t\t\t\tsender phone number\r\n\t -p PASSWORD, --pass PASSWORD\r\n\t\t\t\t\t\t\tserver password\r\n\t -m ADDRESSEE_MOBILE, --mobile ADDRESSEE_MOBILE, --to ADDRESSEE_MOBILE, --send-to ADDRESSEE_MOBILE\r\n\t\t\t\t\t\t\taddressee mobile phone number\r\n\t -r, --read read received text messages (if any)\r\n\t -v [LEVEL], --verbosity [LEVEL], --verbose [LEVEL]\r\n\t\t\t\t\t\t\tincrease output verbosity\r\n\t -s SERVER, --server SERVER\r\n\t\t\t\t\t\t\taText server IP or name\r\n\t -w WAIT, --wait WAIT UDP socket wait time (seconds)\r\n\t --version show version of the asms module\r\n\r\n\tCopyright (C) 2015-2016 baseIT, http://baseit.pl\r\n\r\nsms.cfg\r\n=======\r\nScript creates and uses configuration file \"sms.cfg\" in user's home\r\ndirectory. \r\n\r\nThe following parameters can be set in the configuration file:\r\n\r\n::\r\n\r\n\town_phone = phone_number\r\n\tpassword = password\r\n\tdefaut_country_prefix = phone_number_prefix\r\n\tverbosity = level_of_verbosity\r\n\r\nNote that password is stored in plain form to keep this sample simple.\r\nIn your real application you should store the password in more safe way.\r\n\r\nParameter phone_number_prefix should be set to default prefix of your\r\ncountry, such as 1 for US, 48 for Poland, 49 for Germany, 44 for UK, etc.\r\n\r\nIn addition to parameters, the configuration file stores also address book\r\nin form:\r\n\r\n::\r\n\r\n\tphone_number = alias[:alias[:alias[...]]]\r\n\r\nFor example for line:\r\n\r\n::\r\n\r\n\t+44-7300000000 = John Smith:John\r\n\r\nyou can send texts using phone number as well as \"John Smith\" or John.\r\n\r\nIf you send SMS to phone which is present in your mobile's contacts,\r\nthen your address book in the *sms.cfg* file is automatically updated.\r\n\r\n\r\n\r\n\t\r\nLicense\r\n-------\r\nThe asms module may be downloaded, installed, run and used in accordance with\r\nthe terms of the MIT license:\r\n\r\n\t**Copyright (c) 2015-2016 BaseIT**\r\n\r\n\tPermission is hereby granted, free of charge, to any person obtaining a copy\r\n\tof this software and associated documentation files (the \"Software\"), to deal\r\n\tin the Software without restriction, including without limitation the rights\r\n\tto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n\tcopies of the Software, and to permit persons to whom the Software is\r\n\tfurnished to do so, subject to the following conditions:\r\n\r\n\tThe above copyright notice and this permission notice shall be included in\r\n\tall copies or substantial portions of the Software.\r\n\r\n\tTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\r\n\tOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\n\tFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\n\tAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\n\tLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\r\n\tFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\r\n\tDEALINGS IN THE SOFTWARE.\r\n\r\n.. note::\r\n\tEven though asms module is licensed under MIT license and thus may be\r\n\tused for free, the mobile application aText is licensed on a commercial\r\n\tbasis, and its use is covered by a separate and distinct license agreement.", "description_content_type": null, "docs_url": null, "download_url": "http://baseit.pl/#dload-asms", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://baseit.pl/#product-asms", "keywords": "sms texting text atext telco", "license": "MIT", "maintainer": "baseIT", "maintainer_email": "baseit.app+asms@gmail.com", "name": "asms", "package_url": "https://pypi.org/project/asms/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/asms/", "project_urls": { "Download": "http://baseit.pl/#dload-asms", "Homepage": "http://baseit.pl/#product-asms" }, "release_url": "https://pypi.org/project/asms/1.0.1/", "requires_dist": null, "requires_python": null, "summary": "Provides SMS interface, enabling scripts to send text messages (SMSes) via aText mobile application", "version": "1.0.1" }, "last_serial": 1956246, "releases": { "1.0.1": [ { "comment_text": "", "digests": { "md5": "d6fe1600c4a727396bac59f23b7e2dad", "sha256": "c1399d1fed246c56e1baca15e2401702034e993bfa5b3f5ff1a075807247d312" }, "downloads": -1, "filename": "asms-1.0.1.zip", "has_sig": false, "md5_digest": "d6fe1600c4a727396bac59f23b7e2dad", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 51138, "upload_time": "2016-01-08T17:23:22", "url": "https://files.pythonhosted.org/packages/ea/fd/e2fccbc41ee75f496144e79b30a7d250dda0923d2a2619014ac2aea8831f/asms-1.0.1.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d6fe1600c4a727396bac59f23b7e2dad", "sha256": "c1399d1fed246c56e1baca15e2401702034e993bfa5b3f5ff1a075807247d312" }, "downloads": -1, "filename": "asms-1.0.1.zip", "has_sig": false, "md5_digest": "d6fe1600c4a727396bac59f23b7e2dad", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 51138, "upload_time": "2016-01-08T17:23:22", "url": "https://files.pythonhosted.org/packages/ea/fd/e2fccbc41ee75f496144e79b30a7d250dda0923d2a2619014ac2aea8831f/asms-1.0.1.zip" } ] }