gist methods

create_gist

create_gist(apiuser, files, gistid=<Optional:None>, owner=<Optional:<OptionalAttr:apiuser>>, gist_type=<Optional:u'public'>, lifetime=<Optional:-1>, acl_level=<Optional:u'acl_public'>, description=<Optional:''>)

Creates a new Gist.

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • files (dict) –

    files to be added to the gist. The data structure has to match the following example:

    {'filename1': {'content':'...'}, 'filename2': {'content':'...'}}
    
  • gistid (Optional(str)) – Set a custom id for the gist
  • owner (Optional(str or int)) – Set the gist owner, defaults to api method caller
  • gist_type (Optional(str)) – type of gist public or private
  • lifetime (Optional(int)) – time in minutes of gist lifetime
  • acl_level (Optional(str)) – acl level for this gist, can be acl_public or acl_private If the value is set to acl_private only logged in users are able to access this gist. If not set it defaults to acl_public.
  • description (Optional(str)) – gist description

Example output:

id : <id_given_in_input>
result : {
  "msg": "created new gist",
  "gist": {}
}
error :  null

Example error output:

id : <id_given_in_input>
result : null
error :  {
  "failed to create gist"
}

delete_gist

delete_gist(apiuser, gistid)

Deletes existing gist

Parameters:
  • apiuser (AuthUser) – filled automatically from apikey
  • gistid (str) – id of gist to delete

Example output:

id : <id_given_in_input>
result : {
  "deleted gist ID: <gist_id>",
  "gist": null
}
error :  null

Example error output:

id : <id_given_in_input>
result : null
error :  {
  "failed to delete gist ID:<gist_id>"
}

get_gist

get_gist(apiuser, gistid, content=<Optional:False>)

Get the specified gist, based on the gist ID.

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • gistid (str) – Set the id of the private or public gist
  • content (Optional(bool)) – Return the gist content. Default is false.

get_gists

get_gists(apiuser, userid=<Optional:<OptionalAttr:apiuser>>)

Get all gists for given user. If userid is empty returned gists are for user who called the api

Parameters:
  • apiuser (AuthUser) – This is filled automatically from the Authentication Token.
  • userid (Optional(str or int)) – user to get gists for