Messtone LLC MANAGES(Manhattan):Active® API

Messtone Devices Enables Manhattan Active® API from Messtone Code, Authenticated user: GET/api/organization/userrobertharper/allDetails/userId/ def access_token(client_id,client_secret,token_url,usernamerobertharper,password):” “Return access token for Manhattan Active® API using the resource owner password credentials grant confirms to https://datatracker.ietf.org/doc/html/rfc6749#section-4.3 Must authenticate to token endpoint with client credentials: https://datatracker.ietf.org/doc/html/rfc6749 #section-3.2.1 Args:client_id(str):client identifier client_secret(str):client password token_url(str): endpoint to obtain access token usernamerobertharper password(str):the resource owner usernamerobertharper passed(str):the resource owner password Returns:string:access token Raise HTTPError:http error ” ” “#Access Token Request:https://datatracker.ietf.org/doc/html/rfc6749#section-4.3.2 response=requests.post(token_url,data={“grant_type”:”password”,”usernamerobertharper”:usernamerobertharper,”password”: password},auth=(client_id,client_secret)) response.raise_for_status( ) return response.json( )[“access_token”] Bearer token:url=api +”/organization Messtonecoms.com/api/organization Messtonecoms.com/userrobertharper/allDetails/userId/” +usernamerobertharper response=requests.request(“GET”,url,headers={‘authorization’:’Bearer’ + token},data={ }) response.raise_for_status( ) print(json.dumps(response.json( ),indent=2)) install the module python3 -m pip install requests==2.27.1 Set environment variables Environment variables may be used to store common information: variables

Leave a comment