Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Password Function #28

Open
helpdeskdan opened this issue Oct 19, 2018 · 1 comment
Open

Change Password Function #28

helpdeskdan opened this issue Oct 19, 2018 · 1 comment

Comments

@helpdeskdan
Copy link

helpdeskdan commented Oct 19, 2018

Maybe something like this, probably add private 'put' function. Possibly call another function, as you can change anything with the put. Was in a rush, did this - much thanks much for your project.

    def set_wlan_pass(self, ssid, key):
        """Changes the password for a given
        ssid.  Daniel ToDo: Put method. """
        for wlan in self._api_read('list/wlanconf'):
            if wlan['name'] == ssid:
                wlan_id = wlan['_id']
                wlan_settings = {}
                wlan_settings["x_passphrase"] = key 
                params = json.dumps(wlan_settings)
                url = 'rest/wlanconf/' + wlan_id
                r = self.session.put(self._api_url() + url,
                        params)
                if r.status_code is not 200:
                    raise APIError("Login failed - status code: %i" %  
                            r.status_code)
        return 
@finish06
Copy link
Owner

finish06 commented Apr 2, 2019

Commented on the Pull Request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants