python - Passing in login credentials when making REST calls using Restangular -


i writing application creates data via rest. example while using requests in python save patient

pt = requests.post('http://localhost:8080/openmrs/ws/rest/v1/patient',data=json.dumps(patientpayload),headers=headers,auth=httpbasicauth('myusername','mypassword')) 

how can 1 simulate using restangular these examples found not working

return restangular.all('user/session/authenticate').post({user_id: user_id, password: password}); 

or

var login = restangular.one('auth').custompost( {grant_type:'password', username:'b@t.com', password:'666666', scope:'app'}, 'token', {}, {     authorization:'basic ' + client,     contenttype:'application/x-www-form-urlencoded' } 

);


Comments

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c# - Avoiding duplicate methods for Task and Task<T> -

javascript - Which segment of a polyline was clicked? -