Hi Greg I have already supported add X-Requested-By header in the client. https://issues.apache.org/jira/browse/AMBARI-5663 Unfortunately i forgot to update the wiki. I will update the wiki now. btw thanks for looking into client.Let us know if you find issues, we would be happy to help you.
~Subin On Fri, Jun 20, 2014 at 9:00 PM, Greg Hill <[email protected]> wrote: > Thanks Dmitry. Adding that header does indeed get past the problem. If > nobody else gets to it, I'll get a pull request together for the change. > > Greg > > ________________________________________ > From: Dmitry Lysnichenko [[email protected]] > Sent: Friday, June 20, 2014 10:20 AM > To: [email protected] > Subject: Re: problems with python client > > A quick search through python ambari-client sources did not find any usages > of X-Requested-By header that is used for CSRF protection in Ambari. > > e.g. > > /usr/bin/curl -X DELETE -H "X-Requested-By:anything" -u admin:admin > http://dev01.hortonworks.com:8080/api/v1/clusters/c1/services/MAPREDUCE > > > At the same time, groovy client contains references of this header. So > maybe python client needs update. > > > > On Fri, Jun 20, 2014 at 6:10 PM, Greg Hill <[email protected]> > wrote: > > > I'm trying to use the python client to do a POC with Ambari, but > following > > the examples in the docs has led me to a problem that I can't figure out. > > I set it up with the "Quick Start Guide" and the Ambari UI works > perfectly > > on the 3-node cluster I have running on my machine. I'm just attempting > a > > basic create server call, but the server gives me a 400: Bad Request > > response no matter what I try. Can anyone shed light on this? I turned > on > > DEBUG logging on the server, but there was still no actual details as to > > the problem in the logs. > > > > This is my code: > > > > from ambari_client.ambari_api import AmbariClient > > client = AmbariClient("c6401.ambari.apache.org", 8080, "admin", "admin", > > version=1) > > > > mycluster = client.create_cluster("testcluster", "HDP-2.1") > > > > > > Any ideas? > > > > Greg > > > > > > -- > Thanks, > Dmitry > > -- > CONFIDENTIALITY NOTICE > NOTICE: This message is intended for the use of the individual or entity to > which it is addressed and may contain information that is confidential, > privileged and exempt from disclosure under applicable law. If the reader > of this message is not the intended recipient, you are hereby notified that > any printing, copying, dissemination, distribution, disclosure or > forwarding of this communication is strictly prohibited. If you have > received this communication in error, please contact the sender immediately > and delete it from your system. Thank You. > -- ~Subin
