Great ! Thanks a lot. It works. I didn't know awsauth module. Thanks again. 2013/10/9 Derek Yarnell <derek@xxxxxxxxxxxxxx>: >> Via cli, i do radosgw user info --uid=xxx >> but with the REST API ? > > Hi Alexis, > > Here is a simple python example on how to use the admin api. You will > need to get a few packages from the cheese shop (virtualenv + pip makes > this easy). > > pip install requests-aws > > You will also need to set the appropriate key, secret and server for > your local instance. If you have changed where the admin api lives in > the URI for your radosgw (/admin/ by default) you will need to update > that. You will also need to ensure you set the appropriate 'caps' on > the radosgw for what information you are looking for. Initially this is > done with the 'radosgw-admin caps add' command. The current supported > caps are buckets, metadata, usage and users. You can have either read, > write or * (both). > > radosgw-admin caps add --uid=test --caps="users=*" > > The last thing you need to understand is that you have to sign each > request in the same way you would a S3 request (S3Auth in the following > example). > > import requests > import logging > from awsauth import S3Auth > > logging.basicConfig(level=logging.DEBUG) > > aws_key = 'DFJKJDKLSsdafd321s' > secret = 'j23141kjalJLKDFDM:FDFD+dfDKJHNK' > server = 'radosgw.example.com' > > url = 'https://%s/admin/user?format=json&uid=test' % server > r = requests.get(url, auth=S3Auth(aws_key, secret, server)) > print r.content > > > This produces something that should look like this, > > INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS > connection (1): radosgw.example.com > DEBUG:requests.packages.urllib3.connectionpool:"GET > /admin/user?format=json&uid=test HTTP/1.1" 200 None > {"user_id":"test","display_name":"Testing","email":"","suspended":0,"max_buckets":1000,"subusers":[],"keys":[{"user":"test","access_key":"3FV6LBDJ80D3kI3I9TH8","secret_key":"z+/Rx0Osb3culGMCHL2E3Vg68gpFUSgSxcgf8BG9m"}],"swift_keys":[],"caps":[{"type":"buckets","perm":"*"},{"type":"metadata","perm":"*"},{"type":"usage","perm":"*"},{"type":"users","perm":"*"}]} > > Thanks, > derek > > -- > --- > Derek T. Yarnell > University of Maryland > Institute for Advanced Computer Studies _______________________________________________ ceph-users mailing list ceph-users@xxxxxxxxxxxxxx http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com