{ "info": { "author": "Secure Native", "author_email": "support@securenative.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Software Development :: Build Tools" ], "description": "# Python SDK for Secure Native\n\n## How to get it?\nthe python SDK is published to PyPi so you can just use `pip` to install it:\n```bash\npip install securenative\n```\n\n## Initialize the SDK\nGo to the settings page of your SecureNative account and find your API key, afterwards add this line on your application main module.\n```python\nimport securenative\n\n# Many lines of code ...\n\nif __name__=='__main__':\n # Your bootstrap code\n securenative.init('API_KEY') # Should be called before any other call to secure native\n```\n\n## Tracking Events (async)\nOnce the SDK has been initialized, you can start sending new events with the `track` function:\n```python\nimport securenative\nfrom securenative.event_options import Event, User\n\ndef my_login_function():\n # Many lines of code ...\n \n event = Event( # Build the event from the request's context\n event_type=securenative.event_types.login,\n ip='35.199.23.1',\n remote_ip='35.199.23.2',\n user_agent='Mozilla/5.0 (Linux; U; Android 4.4.2; zh-cn; GT-I9500 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko)Version/4.0 MQQBrowser/5.0 QQ-URL-Manager Mobile Safari/537.36',\n sn_cookie_value='eyJjaWQiOiJkYzgyYjdhZS00ODFkLTQyODItYTMyZC0xZTU1Njk2ZjNmZTQiLCJmcCI6Ijk5NGYzZjVjZTRiYWUwODQzMTRhOTFkNzgyN2I1MWYuMjQ3MDBmOWYxOTg2ODAwYWI0ZmNjODgwNTMwZGQwZWQifQ',\n user=User(\n user_id='1',\n user_email='1@example.com',\n user_name='example example'\n )\n )\n \n # Track it:\n securenative.track(event)\n \n # Many lines of code ...\n\n```\n\n## Verification Events (sync)\nOnce the SDK has been initialized, you can protect sensitive operation by calling the `verify` function, this function will return the risk analysis of the current user.\n\n```python\nimport securenative\nfrom securenative.event_options import Event, User\n\ndef my_change_password_function():\n # Many lines of code...\n \n event = Event( # Build the event from the request's context\n event_type=securenative.event_types.verify,\n ip='35.199.23.1',\n remote_ip='35.199.23.2',\n user_agent='Mozilla/5.0 (Linux; U; Android 4.4.2; zh-cn; GT-I9500 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko)Version/4.0 MQQBrowser/5.0 QQ-URL-Manager Mobile Safari/537.36',\n sn_cookie_value='eyJjaWQiOiJkYzgyYjdhZS00ODFkLTQyODItYTMyZC0xZTU1Njk2ZjNmZTQiLCJmcCI6Ijk5NGYzZjVjZTRiYWUwODQzMTRhOTFkNzgyN2I1MWYuMjQ3MDBmOWYxOTg2ODAwYWI0ZmNjODgwNTMwZGQwZWQifQ',\n user=User(\n user_id='1',\n user_email='1@example.com',\n user_name='example example'\n )\n )\n \n result = securenative.verify(event)\n if result['riskLevel'] == 'high':\n return 'Cannot change password'\n elif result['riskLevel'] == 'medium':\n return 'MFA'\n \n # Many lines of code...\n```\n\n## Verifying Incoming Webhooks\nYou can use the SDK to verify incoming webhooks from Secure Native, just call the `veriy_webhook` function which return a boolean which indicates if the webhook came from Secure Native servers.\n```python\nimport securenative\n\n@post('/sn/webhook')\ndef sn_webhook_handler(headers, body):\n sig_header = headers[\"X-SecureNative\"]\n if securenative.verify_webhook(sig_header, body):\n # Handle the webhook\n level = body['riskLevel']\n pass\n else:\n # This reqeust wasn't sent from Secure Native servers, you can dismiss/investigate it\n pass\n \n```", "description_content_type": "text/markdown", "docs_url": null, "download_url": "https://github.com/securenative/securenative-python/archive/0.1.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://www.securenative.com", "keywords": "securenative,cyber-security", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "securenative", "package_url": "https://pypi.org/project/securenative/", "platform": "", "project_url": "https://pypi.org/project/securenative/", "project_urls": { "Download": "https://github.com/securenative/securenative-python/archive/0.1.tar.gz", "Homepage": "http://www.securenative.com" }, "release_url": "https://pypi.org/project/securenative/0.1.7/", "requires_dist": null, "requires_python": "", "summary": "Secure Native SDK for python", "version": "0.1.7" }, "last_serial": 5595763, "releases": { "0.1.3": [ { "comment_text": "", "digests": { "md5": "45aa50c23b59241080c5bcdac086c182", "sha256": "662d144ce0cca9d105fb25a7042e9656ee02c218c2aee37c270e721a6465663b" }, "downloads": -1, "filename": "securenative-0.1.3.tar.gz", "has_sig": false, "md5_digest": "45aa50c23b59241080c5bcdac086c182", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5040, "upload_time": "2019-07-14T13:29:13", "url": "https://files.pythonhosted.org/packages/aa/e9/46f91a097d64ce9b32e392dc2010d2f5af0b5d98bcd5c45e4b0b2181c1bb/securenative-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "a3200f5197911be937f8695118119047", "sha256": "4ce7695776b794793236917f52823d969e6fe94c852bbc2f5550445c5b94e06d" }, "downloads": -1, "filename": "securenative-0.1.4.tar.gz", "has_sig": false, "md5_digest": "a3200f5197911be937f8695118119047", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7422, "upload_time": "2019-07-16T07:42:38", "url": "https://files.pythonhosted.org/packages/9d/a1/711608341f8afb0857aee1370f5a268dfa7b5c641abf272347838f0251e4/securenative-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "14af9da1787c8231aac57cd978b079f8", "sha256": "92eb0bb11831d607d66cf8ddd2425dfc311487e722ad7e090231dc0fbdafcfca" }, "downloads": -1, "filename": "securenative-0.1.5.tar.gz", "has_sig": false, "md5_digest": "14af9da1787c8231aac57cd978b079f8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7404, "upload_time": "2019-07-16T07:44:04", "url": "https://files.pythonhosted.org/packages/99/35/f52075620705e3cbf36442d3fa99c07878fa3446c468cbd63e9583b3c2ac/securenative-0.1.5.tar.gz" } ], "0.1.6": [ { "comment_text": "", "digests": { "md5": "aa19a4016de4ebf7d9a95aa4f475fb20", "sha256": "3ecf80f0f017d1109925ec23509af6a2c167bbdcd86740c863e5cfe95f31b4f7" }, "downloads": -1, "filename": "securenative-0.1.6.tar.gz", "has_sig": false, "md5_digest": "aa19a4016de4ebf7d9a95aa4f475fb20", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7483, "upload_time": "2019-07-25T14:40:57", "url": "https://files.pythonhosted.org/packages/46/38/3dc7b5336ca486fdfe810c5f71d7a818a311765617af39c81a9558b971aa/securenative-0.1.6.tar.gz" } ], "0.1.7": [ { "comment_text": "", "digests": { "md5": "45db4474d6e09566977932751c94450c", "sha256": "12a961869164da64cb29324fe4d0300ad7da618618529eb7d3edb3c20ad41f11" }, "downloads": -1, "filename": "securenative-0.1.7.tar.gz", "has_sig": false, "md5_digest": "45db4474d6e09566977932751c94450c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7486, "upload_time": "2019-07-28T14:05:26", "url": "https://files.pythonhosted.org/packages/74/30/8791b2c3ffbafdcb5a2048660f932a47bc72ab1e16dd2f1e3cd03ff4ee31/securenative-0.1.7.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "45db4474d6e09566977932751c94450c", "sha256": "12a961869164da64cb29324fe4d0300ad7da618618529eb7d3edb3c20ad41f11" }, "downloads": -1, "filename": "securenative-0.1.7.tar.gz", "has_sig": false, "md5_digest": "45db4474d6e09566977932751c94450c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7486, "upload_time": "2019-07-28T14:05:26", "url": "https://files.pythonhosted.org/packages/74/30/8791b2c3ffbafdcb5a2048660f932a47bc72ab1e16dd2f1e3cd03ff4ee31/securenative-0.1.7.tar.gz" } ] }