SuspendUser not working in python API

9 views
Skip to first unread message

Kua

unread,
Mar 8, 2012, 4:00:56 PM3/8/12
to google-app...@googlegroups.com
The python gdata.apps.client.SuspendUser(user_name) call is not working for me.  When I use the code snippet from the API documentation I get:

    Traceback (most recent call last):
    File "./cgs.py", line 56, in ?
    client.SuspendUser(localpart)
    AttributeError: 'AppsClient' object has no attribute 'SuspendUser'

when I examine the client object I do not see the attribute:

['Batch', 'ClientLogin', 'CreateNickname', 'CreateUser', 'Delete', 'DeleteNickname', 'DeleteUser', 'Get', 'GetAccessToken', 'GetEntry', 'GetFeed', 'GetNext', 'GetOAuthToken', 'ModifyRequest', 'Post', 'Put', 'Request', 'RequestClientLoginToken', 'RetrieveAllPages', 'RetrieveAllUsers', 'RetrieveNickname', 'RetrieveNicknames', 'RetrievePageOfUsers', 'RetrieveUser', 'RevokeToken', 'Update', 'UpdateUser', 'UpgradeToken', '_GDClient__gsessionid', '__class__', '__delattr__', '__dict__', '__doc__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__', '__weakref__', '_baseURL', '_nicknameURL', '_userURL', 'alt_auth_service', 'api_version', 'auth_scopes', 'auth_service', 'auth_token', 'batch', 'client_login', 'delete', 'domain', 'get', 'get_access_token', 'get_entry', 'get_feed', 'get_next', 'get_oauth_token', 'host', 'http_client', 'modify_request', 'post', 'put', 'request', 'request_client_login_token', 'revoke_token', 'source', 'ssl', 'update', 'upgrade_token', 'xoauth_requestor_id']

I notice that the working method RetrieveUser is defined in both client.py and service.py while SuspendUser and RestoreUser (and other
methods) are only defined in service.py.

I can easily workaround this, but it would be great if the provided code snippet worked.

Thanks, Kua

Claudio Cherubino

unread,
Mar 8, 2012, 5:04:11 PM3/8/12
to google-app...@googlegroups.com
Hi Kua,

That's a documentation bug due to the migration from the "old" service class to the "new" client class that we are already addressing.
To suspend an user, you have to retrieve it first, set its login.suspended property to true and then call update, which is exactly what the service.UpdateUser method does:


Claudio


--
You received this message because you are subscribed to the Google Groups "Google Apps Domain Information and Management APIs" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-apps-mgmt-apis/-/mr-Q5ZaxVHAJ.
To post to this group, send email to google-app...@googlegroups.com.
To unsubscribe from this group, send email to google-apps-mgmt...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-apps-mgmt-apis?hl=en.

Reply all
Reply to author
Forward
0 new messages