import json
import requests

""" Order 2: Login system by https

This is the code which use curl to login system
```
curl -k https://192.168.105.88/axapi/v3/auth -H "Content-type:application/json" -d '{
    "credentials": {
        "username": "admin", 
        "password": "a10"
    }
}'
```
"""


class LoginSystemByHttps(object):
    login_url = 'https://192.168.105.88/axapi/v3/auth'

    def login(self):
        """
        Note: the dict playload must be use json.dumps() to turn to str.
        :return: Result string data
        """
        payload = {'credentials': {'username': "admin", 'password': "a10"}}
        headers = {'content-type': 'application/json', 'Connection': 'keep-alive'}
        response = requests.post(self.login_url, data=json.dumps(payload), verify=False, headers=headers)
        print(response.text)
        return response.text


# login = LoginSystemByHttps()
# login.login()

import json
import requests

""" Order 2: Login system by https

This is the code which use curl to login system
```
curl -k https://192.168.105.88/axapi/v3/auth -H "Content-type:application/json" -d '{
    "credentials": {
        "username": "admin", 
        "password": "a10"
    }
}'
```
"""


class LoginSystemByHttps(object):
    login_url = 'http://192.168.105.88/axapi/v3/auth'

    def login(self):
        """
        Note: the dict playload must be use json.dumps() to turn to str.
        :return: Result string data
        """
        payload = {'credentials': {'username': "admin", 'password': "a10"}}
        headers = {'content-type': 'application/json', 'Connection': 'keep-alive'}
        response = requests.post(self.login_url, data=json.dumps(payload), verify=False, headers=headers)
        print(response.text)
        return response.text


# login = LoginSystemByHttps()
# login.login()

--- 
+++ 
@@ -16,7 +16,7 @@
 
 
 class LoginSystemByHttps(object):
-    login_url = 'http://192.168.105.88/axapi/v3/auth'
+    login_url = 'https://192.168.105.88/axapi/v3/auth'
 
     def login(self):
         """
[Order] Order 2: Login system by https
