Hi, <div><br></div><div>Now I have another error. When I use the code of doc/examples/python-api.py inside my server XML-RPC (not the ipa server) that configured like this :<div><br></div><div>== Server ==</div><div>--------- httpd conf ------------<br>

<div><Files "xmlrpc"></div><div>  ## python conf                                                                                                                                                                 </div>

<div>  # ....</div><div>  SetHandler python-program</div><div>  PythonHandler xmlrpchandler</div><div>  PythonDebug on</div><div></Files></div></div><div>------------------------------------</div><div><br></div><div>

the handler xmlrpchandler calls the following method when the client requests for the remote method getUserInfos().</div><div><br></div>--------- account.py ------------<br><div>def getUserInfos(user_name, env=None):</div>

<div><br></div><div>    from ipalib import api</div><div><br></div><div>    api.bootstrap_with_global_options(context='webservices')</div><div>    api.finalize()</div><div>    api.Backend.xmlclient.connect()</div>

<div>    return api.Command.user_show(user_name)  </div><div><div class="gmail_quote"><div class="gmail_quote">------------------------------------</div><div><div><br></div><div><br></div><div>== Client ==</div></div><div>

Now when I call  this method from my client, I get this exception : </div><div><div><br></div><div>------------------------------------</div></div><div><Fault 2: "account.getUserInfos: <type 'exceptions.StandardError'>: API.bootstrap() already called"></div>

<div><div>------------------------------------</div></div><div><br></div><div>I don't know why it does not work, any ideas ?? </div><div><br></div><div>Thanks,</div><div><br></div></div><div class="gmail_quote">2010/4/19 ALAHYANE Rachid <span dir="ltr"><<a href="mailto:afkkir@gmail.com">afkkir@gmail.com</a>></span><br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Thank you for your answer, it works ! <br><br><div class="gmail_quote">2010/4/19 Jason Gerard DeRose <span dir="ltr"><<a href="mailto:jderose@redhat.com" target="_blank">jderose@redhat.com</a>></span><div>

<div></div><div class="h5"><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>On Mon, 2010-04-19 at 16:22 +0200, ALAHYANE Rachid wrote:<br>
> Hi,<br>
><br>
><br>
> Using F12 with the alpha version of ipa, I want to know if there is<br>
> some ways to call implemented methods like  user_show() with my own<br>
> script python. My goal is to call these methods with a client xml-rpc<br>
> that I will to developpe later.<br>
><br>
><br>
> On my client, I tried this but it does not work :(<br>
<br>
</div>It needs more documentation, but see doc/examples/python-api.py<br>
<br>
Let me know if that doesn't work or if you get stuck.  You will need to<br>
do a kinit first.<br>
<div><div></div><div><br>
> ----------------------------------------------------------------------------<br>
> >>> from ipalib import api<br>
> >>> api.bootstrap_with_global_options()<br>
> (<Values at 0xb74f556c: {'debug': None, 'conf': None, 'env': None,<br>
> 'verbose': None}>, [])<br>
> >>> api.load_plugins()<br>
> >>> api.finalize()<br>
> >>> api.Method.user_show.__doc__<br>
> '\n    Display user.\n    '<br>
> >>> api.Method.user_show(u'raca')<br>
> Traceback (most recent call last):<br>
>   File "<stdin>", line 1, in <module><br>
>   File "/usr/lib/python2.6/site-packages/ipalib/frontend.py", line<br>
> 398, in __call__<br>
>     ret = self.run(*args, **options)<br>
>   File "/usr/lib/python2.6/site-packages/ipalib/frontend.py", line<br>
> 667, in run<br>
>     return self.forward(*args, **options)<br>
>   File "/usr/lib/python2.6/site-packages/ipalib/frontend.py", line<br>
> 688, in forward<br>
>     return self.Backend.xmlclient.forward(<a href="http://self.name" target="_blank">self.name</a>, *args, **kw)<br>
>   File "/usr/lib/python2.6/site-packages/ipalib/rpc.py", line 403, in<br>
> forward<br>
>     command = getattr(self.conn, name)<br>
>   File "/usr/lib/python2.6/site-packages/ipalib/backend.py", line 96,<br>
> in __get_conn<br>
>     <a href="http://self.id" target="_blank">self.id</a>, threading.currentThread().getName())<br>
> AttributeError: no context.xmlclient in thread 'MainThread'<br>
><br>
><br>
> ----------------------------------------------------------------------------<br>
><br>
><br>
> Have you any idea ? or some pertinent docs<br>
><br>
><br>
> Sorry for my bad English :)<br>
><br>
><br>
> --<br>
> Meilleures salutations / Best Regards<br>
><br>
> Rachid ALAHYANE<br>
><br>
><br>
</div></div>> _______________________________________________<br>
> Freeipa-users mailing list<br>
> <a href="mailto:Freeipa-users@redhat.com" target="_blank">Freeipa-users@redhat.com</a><br>
> <a href="https://www.redhat.com/mailman/listinfo/freeipa-users" target="_blank">https://www.redhat.com/mailman/listinfo/freeipa-users</a><br>
<br>
</blockquote></div></div></div><div><div></div><div class="h5"><br><br clear="all"><br>-- <br>Meilleures salutations / Best Regards<br><br>Rachid ALAHYANE<br><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Meilleures salutations / Best Regards<br><br>Rachid ALAHYANE<br><br>
</div></div>