Skip to content

etag support #14

@wochinge

Description

@wochinge

Hi,

I suggest to add support for the etag field.
The change would be just a few lines in client.py:

find_attributes = {
    'created': ".//{DAV:}creationdate",
    'name': ".//{DAV:}displayname",
    'size': ".//{DAV:}getcontentlength",
    'modified': ".//{DAV:}getlastmodified",
    'etag': ".//{DAV:}getetag"  # new
}

I'd further add the following to remove the quotes around the etag (without this, it would be something link '"etag"'. I suggest to use the try / except - pattern as most servers are supporting the etag-field, and therefore this is approach is usually faster.

for (name, value) in find_attributes.items():
    info[name] = resp.findtext(value)

# new
try:
    info['etag'] = info['etag'][1:-1]  # remove quotes from etag
except KeyError:
    pass

Cheers
Tobias

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions