Ejemplo n.º 1
0
def cmd_image_upload(client, args):
    """Upload a new image"""
    config = data_fields(args, client.allowed_image_fields)
    if args.type == 'file':
        image = client.upload_from_path(args.image, config)
    else:
        image = client.upload_from_url(args.image, config)
    generate_output({'image': image})
Ejemplo n.º 2
0
def cmd_image_upload(client, args):
    """Upload a new image"""
    config = data_fields(args, client.allowed_image_fields)
    if args.type == 'file':
        image = client.upload_from_path(args.image, config)
    else:
        image = client.upload_from_url(args.image, config)
    generate_output({'image': image})
Ejemplo n.º 3
0
def cmd_album_update(client, args):
    """
    Update the information of an album. For anonymous albums, {album} should be the
    deletehash that is returned at creation
    """
    fields = data_fields(args, client.allowed_album_fields)
    album = client.update_album(args.album_id, fields)
    generate_output({'album': album})
Ejemplo n.º 4
0
def cmd_album_update(client, args):
    """
    Update the information of an album. For anonymous albums, {album} should be the
    deletehash that is returned at creation
    """
    fields = data_fields(args, client.allowed_album_fields)
    album = client.update_album(args.album_id, fields)
    generate_output({'album': album})
Ejemplo n.º 5
0
def cmd_album_create(client, args):
    """
    Create a new album. Optional parameter of ids is an array of image ids to
    add to the album; you have to be logged in as the user for adding the image ids.

    This method is available without authenticating an account, and may be used
    merely by sending "Authorization: Client-ID {client_id}" in the request headers.
    Doing so will create an anonymous album which is not tied to an account
    """
    fields = data_fields(args, client.allowed_album_fields)
    album = client.create_album(fields)
    generate_output({'album': album})
Ejemplo n.º 6
0
def cmd_album_create(client, args):
    """
    Create a new album. Optional parameter of ids is an array of image ids to
    add to the album; you have to be logged in as the user for adding the image ids.

    This method is available without authenticating an account, and may be used
    merely by sending "Authorization: Client-ID {client_id}" in the request headers.
    Doing so will create an anonymous album which is not tied to an account
    """
    fields = data_fields(args, client.allowed_album_fields)
    album = client.create_album(fields)
    generate_output({'album': album})
Ejemplo n.º 7
0
def cmd_account_change_settings(client, args):
    """Updates the account settings for a given user, the user must be logged in"""
    fields = data_fields(args, client.allowed_account_fields)
    account_settings = client.change_account_settings(args.user, fields)
    generate_output({'account_settings': account_settings})
Ejemplo n.º 8
0
def cmd_account_change_settings(client, args):
    """Updates the account settings for a given user, the user must be logged in"""
    fields = data_fields(args, client.allowed_account_fields)
    account_settings = client.change_account_settings(args.user, fields)
    generate_output({'account_settings': account_settings})