Skip to content

Change Password Function #28

@helpdeskdan

Description

@helpdeskdan

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 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions