#NEWLINE# def add_user_key( self , obj , validity = 0 , max_queries_per_ip_per_hour = 0 , max_hits_per_query = 0 ) : #NEWLINE# #INDENT# '\n        Create a new user key associated to this index (can only access to\n        this index).\n\n        @param obj can be two different parameters:\n            The list of parameters for this key. Defined by a dictionary that\n            can contains the following values:\n                - acl: array of string\n                - indices: array of string\n                - validity: int\n                - referers: array of string\n                - description: string\n                - maxHitsPerQuery: integer\n                - queryParameters: string\n                - maxQueriesPerIPPerHour: integer\n            Or the list of ACL for this key. Defined by an array of string that\n            can contains the following values:\n                - search: allow to search (https and http)\n                - addObject: allows to add/update an object in the index (https only)\n                - deleteObject : allows to delete an existing object (https only)\n                - deleteIndex : allows to delete index content (https only)\n                - settings : allows to get index settings (https only)\n                - editSettings : allows to change index settings (https only)\n        @param validity the number of seconds after which the key will be\n            automatically removed (0 means no time limit for this key)\n        @param max_queries_per_ip_per_hour Specify the maximum number of API\n            calls allowed from an IP address per hour.  Defaults to 0 (no\n            rate limit)\n        @param max_hits_per_query Specify the maximum number of hits this\n            API key can retrieve in one call. Defaults to 0 (unlimited)\n        ' #NEWLINE# if ( not isinstance ( obj , dict ) ) : #NEWLINE# #INDENT# obj = { #NEWLINE# #INDENT# 'acl' : obj , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# obj . update ( { #NEWLINE# #INDENT# 'validity' : validity , #NEWLINE# 'maxQueriesPerIPPerHour' : max_queries_per_ip_per_hour , #NEWLINE# 'maxHitsPerQuery' : max_hits_per_query , #NEWLINE# #UNINDENT# } ) #NEWLINE# return self . _perform_request ( self . write_hosts , '/keys' , 'POST' , body = obj )