coherence.upnp.core (package)¶
coherence.upnp.core.DIDLLite (module)¶
TODO:
- use more XPath expressions in fromElement() methods
-
class
Resources
[source]¶ Bases:
list
a list of resources, always sorted after an append
-
p_sort
(x, y)[source]¶ we want the following order http-get is always at the beginning rtsp-rtp-udp the second anything else after that
-
clear
()¶ Remove all items from list.
-
copy
()¶ Return a shallow copy of the list.
-
count
()¶ Return number of occurrences of value.
-
extend
()¶ Extend list by appending elements from the iterable.
-
index
()¶ Return first index of value.
Raises ValueError if the value is not present.
-
insert
()¶ Insert object before index.
-
pop
()¶ Remove and return item at index (default last).
Raises IndexError if list is empty or index is out of range.
-
remove
()¶ Remove first occurrence of value.
Raises ValueError if the value is not present.
-
reverse
()¶ Reverse IN PLACE.
-
sort
()¶ Stable sort IN PLACE.
-
-
class
Resource
(data=None, protocol_info=None)[source]¶ Bases:
object
An object representing a resource.
-
class
PlayContainerResource
(udn, sid='urn:upnp-org:serviceId:ContentDirectory', cid=None, fid=None, fii=0, sc='', md=0, protocol_info=None)[source]¶ Bases:
coherence.upnp.core.DIDLLite.Resource
An object representing a DLNA playcontainer resource.
-
fromElement
(elt)¶
-
classmethod
fromString
(_string)¶
-
get_additional_info
(upnp_client='')¶
-
toElement
(**kwargs)¶
-
toString
(**kwargs)¶
-
transcoded
(format)¶
-
-
class
Object
(id=None, parentID=None, title=None, restricted=False, creator=None)[source]¶ Bases:
coherence.log.LogAble
The root class of the entire content directory class heirachy.
-
logCategory
= 'didllite'¶
-
elementName
= None¶
-
upnp_class
= 'object'¶
-
writeStatus
= None¶
-
date
= None¶
-
albumArtURI
= None¶
-
artist
= None¶
-
genre
= None¶
-
genres
= None¶
-
album
= None¶
-
originalTrackNumber
= None¶
-
description
= None¶
-
longDescription
= None¶
-
refID
= None¶
-
server_uuid
= None¶
-
creator
= None¶
-
res
= None¶
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
critical
(message, *args, **kwargs)¶
-
debug
(message, *args, **kwargs)¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
info
(message, *args, **kwargs)¶
-
log
(message, *args, **kwargs)¶
-
msg
(message, *args, **kwargs)¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
-
class
Item
(*args, **kwargs)[source]¶ Bases:
coherence.upnp.core.DIDLLite.Object
A class used to represent atomic (non-container) content objects.
-
upnp_class
= 'object.item'¶
-
elementName
= 'item'¶
-
refID
= None¶
-
director
= None¶
-
actors
= []¶
-
language
= None¶
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
album
= None¶
-
albumArtURI
= None¶
-
artist
= None¶
-
checkUpdate
()¶
-
creator
= None¶
-
critical
(message, *args, **kwargs)¶
-
date
= None¶
-
debug
(message, *args, **kwargs)¶
-
description
= None¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
classmethod
fromString
(data)¶
-
genre
= None¶
-
genres
= None¶
-
info
(message, *args, **kwargs)¶
-
log
(message, *args, **kwargs)¶
-
logCategory
= 'didllite'¶
-
longDescription
= None¶
-
msg
(message, *args, **kwargs)¶
-
originalTrackNumber
= None¶
-
res
= None¶
-
server_uuid
= None¶
-
toString
(**kwargs)¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
writeStatus
= None¶
-
-
class
ImageItem
(*args, **kwargs)[source]¶ Bases:
coherence.upnp.core.DIDLLite.Item
-
upnp_class
= 'object.item.imageItem'¶
-
rating
= None¶
-
storageMedium
= None¶
-
publisher
= None¶
-
rights
= None¶
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
actors
= []¶
-
album
= None¶
-
albumArtURI
= None¶
-
artist
= None¶
-
checkUpdate
()¶
-
creator
= None¶
-
critical
(message, *args, **kwargs)¶
-
date
= None¶
-
debug
(message, *args, **kwargs)¶
-
description
= None¶
-
director
= None¶
-
elementName
= 'item'¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
fromElement
(elt)¶ TODO: * creator * writeStatus
-
classmethod
fromString
(data)¶
-
genre
= None¶
-
genres
= None¶
-
info
(message, *args, **kwargs)¶
-
language
= None¶
-
log
(message, *args, **kwargs)¶
-
logCategory
= 'didllite'¶
-
longDescription
= None¶
-
msg
(message, *args, **kwargs)¶
-
originalTrackNumber
= None¶
-
refID
= None¶
-
res
= None¶
-
server_uuid
= None¶
-
toString
(**kwargs)¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
writeStatus
= None¶
-
-
class
Photo
(*args, **kwargs)[source]¶ Bases:
coherence.upnp.core.DIDLLite.ImageItem
-
upnp_class
= 'object.item.imageItem.photo'¶
-
album
= None¶
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
actors
= []¶
-
albumArtURI
= None¶
-
artist
= None¶
-
checkUpdate
()¶
-
creator
= None¶
-
critical
(message, *args, **kwargs)¶
-
date
= None¶
-
debug
(message, *args, **kwargs)¶
-
description
= None¶
-
director
= None¶
-
elementName
= 'item'¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
fromElement
(elt)¶ TODO: * creator * writeStatus
-
classmethod
fromString
(data)¶
-
genre
= None¶
-
genres
= None¶
-
info
(message, *args, **kwargs)¶
-
language
= None¶
-
log
(message, *args, **kwargs)¶
-
logCategory
= 'didllite'¶
-
longDescription
= None¶
-
msg
(message, *args, **kwargs)¶
-
originalTrackNumber
= None¶
-
publisher
= None¶
-
rating
= None¶
-
refID
= None¶
-
res
= None¶
-
rights
= None¶
-
server_uuid
= None¶
-
storageMedium
= None¶
-
toString
(**kwargs)¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
writeStatus
= None¶
-
-
class
AudioItem
(*args, **kwargs)[source]¶ Bases:
coherence.upnp.core.DIDLLite.Item
A piece of content that when rendered generates some audio.
-
upnp_class
= 'object.item.audioItem'¶
-
publisher
= None¶
-
language
= None¶
-
relation
= None¶
-
rights
= None¶
-
valid_keys
= ['genre', 'description', 'longDescription', 'publisher', 'language', 'relation', 'rights', 'albumArtURI']¶
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
actors
= []¶
-
album
= None¶
-
albumArtURI
= None¶
-
artist
= None¶
-
checkUpdate
()¶
-
creator
= None¶
-
critical
(message, *args, **kwargs)¶
-
date
= None¶
-
debug
(message, *args, **kwargs)¶
-
description
= None¶
-
director
= None¶
-
elementName
= 'item'¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
classmethod
fromString
(data)¶
-
genre
= None¶
-
genres
= None¶
-
info
(message, *args, **kwargs)¶
-
log
(message, *args, **kwargs)¶
-
logCategory
= 'didllite'¶
-
longDescription
= None¶
-
msg
(message, *args, **kwargs)¶
-
originalTrackNumber
= None¶
-
refID
= None¶
-
res
= None¶
-
server_uuid
= None¶
-
toString
(**kwargs)¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
writeStatus
= None¶
-
-
class
MusicTrack
(*args, **kwargs)[source]¶ Bases:
coherence.upnp.core.DIDLLite.AudioItem
A discrete piece of audio that should be interpreted as music.
-
upnp_class
= 'object.item.audioItem.musicTrack'¶
-
album
= None¶
-
playlist
= None¶
-
storageMedium
= None¶
-
contributor
= None¶
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
actors
= []¶
-
albumArtURI
= None¶
-
artist
= None¶
-
checkUpdate
()¶
-
creator
= None¶
-
critical
(message, *args, **kwargs)¶
-
date
= None¶
-
debug
(message, *args, **kwargs)¶
-
description
= None¶
-
director
= None¶
-
elementName
= 'item'¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
fromElement
(elt)¶ TODO: * creator * writeStatus
-
classmethod
fromString
(data)¶
-
genre
= None¶
-
genres
= None¶
-
info
(message, *args, **kwargs)¶
-
language
= None¶
-
log
(message, *args, **kwargs)¶
-
logCategory
= 'didllite'¶
-
longDescription
= None¶
-
msg
(message, *args, **kwargs)¶
-
originalTrackNumber
= None¶
-
publisher
= None¶
-
refID
= None¶
-
relation
= None¶
-
res
= None¶
-
rights
= None¶
-
server_uuid
= None¶
-
toString
(**kwargs)¶
-
valid_keys
= ['genre', 'description', 'longDescription', 'publisher', 'language', 'relation', 'rights', 'albumArtURI']¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
writeStatus
= None¶
-
-
class
AudioBroadcast
(*args, **kwargs)[source]¶ Bases:
coherence.upnp.core.DIDLLite.AudioItem
-
upnp_class
= 'object.item.audioItem.audioBroadcast'¶
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
actors
= []¶
-
album
= None¶
-
albumArtURI
= None¶
-
artist
= None¶
-
checkUpdate
()¶
-
creator
= None¶
-
critical
(message, *args, **kwargs)¶
-
date
= None¶
-
debug
(message, *args, **kwargs)¶
-
description
= None¶
-
director
= None¶
-
elementName
= 'item'¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
fromElement
(elt)¶ TODO: * creator * writeStatus
-
classmethod
fromString
(data)¶
-
genre
= None¶
-
genres
= None¶
-
info
(message, *args, **kwargs)¶
-
language
= None¶
-
log
(message, *args, **kwargs)¶
-
logCategory
= 'didllite'¶
-
longDescription
= None¶
-
msg
(message, *args, **kwargs)¶
-
originalTrackNumber
= None¶
-
publisher
= None¶
-
refID
= None¶
-
relation
= None¶
-
res
= None¶
-
rights
= None¶
-
server_uuid
= None¶
-
toElement
(**kwargs)¶
-
toString
(**kwargs)¶
-
valid_keys
= ['genre', 'description', 'longDescription', 'publisher', 'language', 'relation', 'rights', 'albumArtURI']¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
writeStatus
= None¶
-
-
class
AudioBook
(*args, **kwargs)[source]¶ Bases:
coherence.upnp.core.DIDLLite.AudioItem
-
upnp_class
= 'object.item.audioItem.audioBook'¶
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
actors
= []¶
-
album
= None¶
-
albumArtURI
= None¶
-
artist
= None¶
-
checkUpdate
()¶
-
creator
= None¶
-
critical
(message, *args, **kwargs)¶
-
date
= None¶
-
debug
(message, *args, **kwargs)¶
-
description
= None¶
-
director
= None¶
-
elementName
= 'item'¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
fromElement
(elt)¶ TODO: * creator * writeStatus
-
classmethod
fromString
(data)¶
-
genre
= None¶
-
genres
= None¶
-
info
(message, *args, **kwargs)¶
-
language
= None¶
-
log
(message, *args, **kwargs)¶
-
logCategory
= 'didllite'¶
-
longDescription
= None¶
-
msg
(message, *args, **kwargs)¶
-
originalTrackNumber
= None¶
-
publisher
= None¶
-
refID
= None¶
-
relation
= None¶
-
res
= None¶
-
rights
= None¶
-
server_uuid
= None¶
-
toElement
(**kwargs)¶
-
toString
(**kwargs)¶
-
valid_keys
= ['genre', 'description', 'longDescription', 'publisher', 'language', 'relation', 'rights', 'albumArtURI']¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
writeStatus
= None¶
-
-
class
VideoItem
(*args, **kwargs)[source]¶ Bases:
coherence.upnp.core.DIDLLite.Item
-
upnp_class
= 'object.item.videoItem'¶
-
valid_attrs
= {'producer': 'urn:schemas-upnp-org:metadata-1-0/upnp/', 'publisher': 'http://purl.org/dc/elements/1.1/', 'rating': 'urn:schemas-upnp-org:metadata-1-0/upnp/', 'relation': 'http://purl.org/dc/elements/1.1/'}¶
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
actors
= []¶
-
album
= None¶
-
albumArtURI
= None¶
-
artist
= None¶
-
checkUpdate
()¶
-
creator
= None¶
-
critical
(message, *args, **kwargs)¶
-
date
= None¶
-
debug
(message, *args, **kwargs)¶
-
description
= None¶
-
director
= None¶
-
elementName
= 'item'¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
classmethod
fromString
(data)¶
-
genre
= None¶
-
genres
= None¶
-
info
(message, *args, **kwargs)¶
-
language
= None¶
-
log
(message, *args, **kwargs)¶
-
logCategory
= 'didllite'¶
-
longDescription
= None¶
-
msg
(message, *args, **kwargs)¶
-
originalTrackNumber
= None¶
-
refID
= None¶
-
res
= None¶
-
server_uuid
= None¶
-
toString
(**kwargs)¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
writeStatus
= None¶
-
-
class
Movie
(*args, **kwargs)[source]¶ Bases:
coherence.upnp.core.DIDLLite.VideoItem
-
upnp_class
= 'object.item.videoItem.movie'¶
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
actors
= []¶
-
album
= None¶
-
albumArtURI
= None¶
-
artist
= None¶
-
checkUpdate
()¶
-
creator
= None¶
-
critical
(message, *args, **kwargs)¶
-
date
= None¶
-
debug
(message, *args, **kwargs)¶
-
description
= None¶
-
director
= None¶
-
elementName
= 'item'¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
fromElement
(elt)¶ TODO: * creator * writeStatus
-
classmethod
fromString
(data)¶
-
genre
= None¶
-
genres
= None¶
-
info
(message, *args, **kwargs)¶
-
language
= None¶
-
log
(message, *args, **kwargs)¶
-
logCategory
= 'didllite'¶
-
longDescription
= None¶
-
msg
(message, *args, **kwargs)¶
-
originalTrackNumber
= None¶
-
refID
= None¶
-
res
= None¶
-
server_uuid
= None¶
-
toElement
(**kwargs)¶
-
toString
(**kwargs)¶
-
valid_attrs
= {'producer': 'urn:schemas-upnp-org:metadata-1-0/upnp/', 'publisher': 'http://purl.org/dc/elements/1.1/', 'rating': 'urn:schemas-upnp-org:metadata-1-0/upnp/', 'relation': 'http://purl.org/dc/elements/1.1/'}¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
writeStatus
= None¶
-
-
class
VideoBroadcast
(*args, **kwargs)[source]¶ Bases:
coherence.upnp.core.DIDLLite.VideoItem
-
upnp_class
= 'object.item.videoItem.videoBroadcast'¶
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
actors
= []¶
-
album
= None¶
-
albumArtURI
= None¶
-
artist
= None¶
-
checkUpdate
()¶
-
creator
= None¶
-
critical
(message, *args, **kwargs)¶
-
date
= None¶
-
debug
(message, *args, **kwargs)¶
-
description
= None¶
-
director
= None¶
-
elementName
= 'item'¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
fromElement
(elt)¶ TODO: * creator * writeStatus
-
classmethod
fromString
(data)¶
-
genre
= None¶
-
genres
= None¶
-
info
(message, *args, **kwargs)¶
-
language
= None¶
-
log
(message, *args, **kwargs)¶
-
logCategory
= 'didllite'¶
-
longDescription
= None¶
-
msg
(message, *args, **kwargs)¶
-
originalTrackNumber
= None¶
-
refID
= None¶
-
res
= None¶
-
server_uuid
= None¶
-
toElement
(**kwargs)¶
-
toString
(**kwargs)¶
-
valid_attrs
= {'producer': 'urn:schemas-upnp-org:metadata-1-0/upnp/', 'publisher': 'http://purl.org/dc/elements/1.1/', 'rating': 'urn:schemas-upnp-org:metadata-1-0/upnp/', 'relation': 'http://purl.org/dc/elements/1.1/'}¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
writeStatus
= None¶
-
-
class
MusicVideoClip
(*args, **kwargs)[source]¶ Bases:
coherence.upnp.core.DIDLLite.VideoItem
-
upnp_class
= 'object.item.videoItem.musicVideoClip'¶
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
actors
= []¶
-
album
= None¶
-
albumArtURI
= None¶
-
artist
= None¶
-
checkUpdate
()¶
-
creator
= None¶
-
critical
(message, *args, **kwargs)¶
-
date
= None¶
-
debug
(message, *args, **kwargs)¶
-
description
= None¶
-
director
= None¶
-
elementName
= 'item'¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
fromElement
(elt)¶ TODO: * creator * writeStatus
-
classmethod
fromString
(data)¶
-
genre
= None¶
-
genres
= None¶
-
info
(message, *args, **kwargs)¶
-
language
= None¶
-
log
(message, *args, **kwargs)¶
-
logCategory
= 'didllite'¶
-
longDescription
= None¶
-
msg
(message, *args, **kwargs)¶
-
originalTrackNumber
= None¶
-
refID
= None¶
-
res
= None¶
-
server_uuid
= None¶
-
toElement
(**kwargs)¶
-
toString
(**kwargs)¶
-
valid_attrs
= {'producer': 'urn:schemas-upnp-org:metadata-1-0/upnp/', 'publisher': 'http://purl.org/dc/elements/1.1/', 'rating': 'urn:schemas-upnp-org:metadata-1-0/upnp/', 'relation': 'http://purl.org/dc/elements/1.1/'}¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
writeStatus
= None¶
-
-
class
PlaylistItem
(*args, **kwargs)[source]¶ Bases:
coherence.upnp.core.DIDLLite.Item
-
upnp_class
= 'object.item.playlistItem'¶
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
actors
= []¶
-
album
= None¶
-
albumArtURI
= None¶
-
artist
= None¶
-
checkUpdate
()¶
-
creator
= None¶
-
critical
(message, *args, **kwargs)¶
-
date
= None¶
-
debug
(message, *args, **kwargs)¶
-
description
= None¶
-
director
= None¶
-
elementName
= 'item'¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
fromElement
(elt)¶ TODO: * creator * writeStatus
-
classmethod
fromString
(data)¶
-
genre
= None¶
-
genres
= None¶
-
info
(message, *args, **kwargs)¶
-
language
= None¶
-
log
(message, *args, **kwargs)¶
-
logCategory
= 'didllite'¶
-
longDescription
= None¶
-
msg
(message, *args, **kwargs)¶
-
originalTrackNumber
= None¶
-
refID
= None¶
-
res
= None¶
-
server_uuid
= None¶
-
toElement
(**kwargs)¶
-
toString
(**kwargs)¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
writeStatus
= None¶
-
-
class
TextItem
(*args, **kwargs)[source]¶ Bases:
coherence.upnp.core.DIDLLite.Item
-
upnp_class
= 'object.item.textItem'¶
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
actors
= []¶
-
album
= None¶
-
albumArtURI
= None¶
-
artist
= None¶
-
checkUpdate
()¶
-
creator
= None¶
-
critical
(message, *args, **kwargs)¶
-
date
= None¶
-
debug
(message, *args, **kwargs)¶
-
description
= None¶
-
director
= None¶
-
elementName
= 'item'¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
fromElement
(elt)¶ TODO: * creator * writeStatus
-
classmethod
fromString
(data)¶
-
genre
= None¶
-
genres
= None¶
-
info
(message, *args, **kwargs)¶
-
language
= None¶
-
log
(message, *args, **kwargs)¶
-
logCategory
= 'didllite'¶
-
longDescription
= None¶
-
msg
(message, *args, **kwargs)¶
-
originalTrackNumber
= None¶
-
refID
= None¶
-
res
= None¶
-
server_uuid
= None¶
-
toElement
(**kwargs)¶
-
toString
(**kwargs)¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
writeStatus
= None¶
-
-
class
Container
(id=None, parent_id=None, title=None, restricted=False, creator=None)[source]¶ Bases:
coherence.upnp.core.DIDLLite.Object
An object that can contain other objects.
-
upnp_class
= 'object.container'¶
-
elementName
= 'container'¶
-
childCount
= None¶
-
createClass
= None¶
-
searchable
= None¶
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
album
= None¶
-
albumArtURI
= None¶
-
artist
= None¶
-
checkUpdate
()¶
-
creator
= None¶
-
critical
(message, *args, **kwargs)¶
-
date
= None¶
-
debug
(message, *args, **kwargs)¶
-
description
= None¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
classmethod
fromString
(data)¶
-
genre
= None¶
-
genres
= None¶
-
info
(message, *args, **kwargs)¶
-
log
(message, *args, **kwargs)¶
-
logCategory
= 'didllite'¶
-
longDescription
= None¶
-
msg
(message, *args, **kwargs)¶
-
originalTrackNumber
= None¶
-
refID
= None¶
-
res
= None¶
-
server_uuid
= None¶
-
toString
(**kwargs)¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
writeStatus
= None¶
-
-
class
Person
(id=None, parent_id=None, title=None, restricted=False, creator=None)[source]¶ Bases:
coherence.upnp.core.DIDLLite.Container
-
upnp_class
= 'object.container.person'¶
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
album
= None¶
-
albumArtURI
= None¶
-
artist
= None¶
-
checkUpdate
()¶
-
childCount
= None¶
-
createClass
= None¶
-
creator
= None¶
-
critical
(message, *args, **kwargs)¶
-
date
= None¶
-
debug
(message, *args, **kwargs)¶
-
description
= None¶
-
elementName
= 'container'¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
fromElement
(elt)¶ TODO: * creator * writeStatus
-
classmethod
fromString
(data)¶
-
genre
= None¶
-
genres
= None¶
-
info
(message, *args, **kwargs)¶
-
log
(message, *args, **kwargs)¶
-
logCategory
= 'didllite'¶
-
longDescription
= None¶
-
msg
(message, *args, **kwargs)¶
-
originalTrackNumber
= None¶
-
refID
= None¶
-
res
= None¶
-
searchable
= None¶
-
server_uuid
= None¶
-
toElement
(**kwargs)¶
-
toString
(**kwargs)¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
writeStatus
= None¶
-
-
class
MusicArtist
(id=None, parent_id=None, title=None, restricted=False, creator=None)[source]¶ Bases:
coherence.upnp.core.DIDLLite.Person
-
upnp_class
= 'object.container.person.musicArtist'¶
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
album
= None¶
-
albumArtURI
= None¶
-
artist
= None¶
-
checkUpdate
()¶
-
childCount
= None¶
-
createClass
= None¶
-
creator
= None¶
-
critical
(message, *args, **kwargs)¶
-
date
= None¶
-
debug
(message, *args, **kwargs)¶
-
description
= None¶
-
elementName
= 'container'¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
fromElement
(elt)¶ TODO: * creator * writeStatus
-
classmethod
fromString
(data)¶
-
genre
= None¶
-
genres
= None¶
-
info
(message, *args, **kwargs)¶
-
log
(message, *args, **kwargs)¶
-
logCategory
= 'didllite'¶
-
longDescription
= None¶
-
msg
(message, *args, **kwargs)¶
-
originalTrackNumber
= None¶
-
refID
= None¶
-
res
= None¶
-
searchable
= None¶
-
server_uuid
= None¶
-
toElement
(**kwargs)¶
-
toString
(**kwargs)¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
writeStatus
= None¶
-
-
class
PlaylistContainer
(id=None, parent_id=None, title=None, restricted=False, creator=None)[source]¶ Bases:
coherence.upnp.core.DIDLLite.Container
-
upnp_class
= 'object.container.playlistContainer'¶
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
album
= None¶
-
albumArtURI
= None¶
-
artist
= None¶
-
checkUpdate
()¶
-
childCount
= None¶
-
createClass
= None¶
-
creator
= None¶
-
critical
(message, *args, **kwargs)¶
-
date
= None¶
-
debug
(message, *args, **kwargs)¶
-
description
= None¶
-
elementName
= 'container'¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
fromElement
(elt)¶ TODO: * creator * writeStatus
-
classmethod
fromString
(data)¶
-
genre
= None¶
-
genres
= None¶
-
info
(message, *args, **kwargs)¶
-
log
(message, *args, **kwargs)¶
-
logCategory
= 'didllite'¶
-
longDescription
= None¶
-
msg
(message, *args, **kwargs)¶
-
originalTrackNumber
= None¶
-
refID
= None¶
-
res
= None¶
-
searchable
= None¶
-
server_uuid
= None¶
-
toElement
(**kwargs)¶
-
toString
(**kwargs)¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
writeStatus
= None¶
-
-
class
Album
(id=None, parent_id=None, title=None, restricted=False, creator=None)[source]¶ Bases:
coherence.upnp.core.DIDLLite.Container
-
upnp_class
= 'object.container.album'¶
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
album
= None¶
-
albumArtURI
= None¶
-
artist
= None¶
-
checkUpdate
()¶
-
childCount
= None¶
-
createClass
= None¶
-
creator
= None¶
-
critical
(message, *args, **kwargs)¶
-
date
= None¶
-
debug
(message, *args, **kwargs)¶
-
description
= None¶
-
elementName
= 'container'¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
fromElement
(elt)¶ TODO: * creator * writeStatus
-
classmethod
fromString
(data)¶
-
genre
= None¶
-
genres
= None¶
-
info
(message, *args, **kwargs)¶
-
log
(message, *args, **kwargs)¶
-
logCategory
= 'didllite'¶
-
longDescription
= None¶
-
msg
(message, *args, **kwargs)¶
-
originalTrackNumber
= None¶
-
refID
= None¶
-
res
= None¶
-
searchable
= None¶
-
server_uuid
= None¶
-
toElement
(**kwargs)¶
-
toString
(**kwargs)¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
writeStatus
= None¶
-
-
class
MusicAlbum
(id=None, parent_id=None, title=None, restricted=False, creator=None)[source]¶ Bases:
coherence.upnp.core.DIDLLite.Album
-
upnp_class
= 'object.container.album.musicAlbum'¶
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
album
= None¶
-
albumArtURI
= None¶
-
artist
= None¶
-
checkUpdate
()¶
-
childCount
= None¶
-
createClass
= None¶
-
creator
= None¶
-
critical
(message, *args, **kwargs)¶
-
date
= None¶
-
debug
(message, *args, **kwargs)¶
-
description
= None¶
-
elementName
= 'container'¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
fromElement
(elt)¶ TODO: * creator * writeStatus
-
classmethod
fromString
(data)¶
-
genre
= None¶
-
genres
= None¶
-
info
(message, *args, **kwargs)¶
-
log
(message, *args, **kwargs)¶
-
logCategory
= 'didllite'¶
-
longDescription
= None¶
-
msg
(message, *args, **kwargs)¶
-
originalTrackNumber
= None¶
-
refID
= None¶
-
res
= None¶
-
searchable
= None¶
-
server_uuid
= None¶
-
toElement
(**kwargs)¶
-
toString
(**kwargs)¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
writeStatus
= None¶
-
-
class
PhotoAlbum
(id=None, parent_id=None, title=None, restricted=False, creator=None)[source]¶ Bases:
coherence.upnp.core.DIDLLite.Album
-
upnp_class
= 'object.container.album.photoAlbum'¶
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
album
= None¶
-
albumArtURI
= None¶
-
artist
= None¶
-
checkUpdate
()¶
-
childCount
= None¶
-
createClass
= None¶
-
creator
= None¶
-
critical
(message, *args, **kwargs)¶
-
date
= None¶
-
debug
(message, *args, **kwargs)¶
-
description
= None¶
-
elementName
= 'container'¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
fromElement
(elt)¶ TODO: * creator * writeStatus
-
classmethod
fromString
(data)¶
-
genre
= None¶
-
genres
= None¶
-
info
(message, *args, **kwargs)¶
-
log
(message, *args, **kwargs)¶
-
logCategory
= 'didllite'¶
-
longDescription
= None¶
-
msg
(message, *args, **kwargs)¶
-
originalTrackNumber
= None¶
-
refID
= None¶
-
res
= None¶
-
searchable
= None¶
-
server_uuid
= None¶
-
toElement
(**kwargs)¶
-
toString
(**kwargs)¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
writeStatus
= None¶
-
-
class
Genre
(id=None, parent_id=None, title=None, restricted=False, creator=None)[source]¶ Bases:
coherence.upnp.core.DIDLLite.Container
-
upnp_class
= 'object.container.genre'¶
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
album
= None¶
-
albumArtURI
= None¶
-
artist
= None¶
-
checkUpdate
()¶
-
childCount
= None¶
-
createClass
= None¶
-
creator
= None¶
-
critical
(message, *args, **kwargs)¶
-
date
= None¶
-
debug
(message, *args, **kwargs)¶
-
description
= None¶
-
elementName
= 'container'¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
fromElement
(elt)¶ TODO: * creator * writeStatus
-
classmethod
fromString
(data)¶
-
genre
= None¶
-
genres
= None¶
-
info
(message, *args, **kwargs)¶
-
log
(message, *args, **kwargs)¶
-
logCategory
= 'didllite'¶
-
longDescription
= None¶
-
msg
(message, *args, **kwargs)¶
-
originalTrackNumber
= None¶
-
refID
= None¶
-
res
= None¶
-
searchable
= None¶
-
server_uuid
= None¶
-
toElement
(**kwargs)¶
-
toString
(**kwargs)¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
writeStatus
= None¶
-
-
class
MusicGenre
(id=None, parent_id=None, title=None, restricted=False, creator=None)[source]¶ Bases:
coherence.upnp.core.DIDLLite.Genre
-
upnp_class
= 'object.container.genre.musicGenre'¶
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
album
= None¶
-
albumArtURI
= None¶
-
artist
= None¶
-
checkUpdate
()¶
-
childCount
= None¶
-
createClass
= None¶
-
creator
= None¶
-
critical
(message, *args, **kwargs)¶
-
date
= None¶
-
debug
(message, *args, **kwargs)¶
-
description
= None¶
-
elementName
= 'container'¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
fromElement
(elt)¶ TODO: * creator * writeStatus
-
classmethod
fromString
(data)¶
-
genre
= None¶
-
genres
= None¶
-
info
(message, *args, **kwargs)¶
-
log
(message, *args, **kwargs)¶
-
logCategory
= 'didllite'¶
-
longDescription
= None¶
-
msg
(message, *args, **kwargs)¶
-
originalTrackNumber
= None¶
-
refID
= None¶
-
res
= None¶
-
searchable
= None¶
-
server_uuid
= None¶
-
toElement
(**kwargs)¶
-
toString
(**kwargs)¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
writeStatus
= None¶
-
-
class
MovieGenre
(id=None, parent_id=None, title=None, restricted=False, creator=None)[source]¶ Bases:
coherence.upnp.core.DIDLLite.Genre
-
upnp_class
= 'object.container.genre.movieGenre'¶
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
album
= None¶
-
albumArtURI
= None¶
-
artist
= None¶
-
checkUpdate
()¶
-
childCount
= None¶
-
createClass
= None¶
-
creator
= None¶
-
critical
(message, *args, **kwargs)¶
-
date
= None¶
-
debug
(message, *args, **kwargs)¶
-
description
= None¶
-
elementName
= 'container'¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
fromElement
(elt)¶ TODO: * creator * writeStatus
-
classmethod
fromString
(data)¶
-
genre
= None¶
-
genres
= None¶
-
info
(message, *args, **kwargs)¶
-
log
(message, *args, **kwargs)¶
-
logCategory
= 'didllite'¶
-
longDescription
= None¶
-
msg
(message, *args, **kwargs)¶
-
originalTrackNumber
= None¶
-
refID
= None¶
-
res
= None¶
-
searchable
= None¶
-
server_uuid
= None¶
-
toElement
(**kwargs)¶
-
toString
(**kwargs)¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
writeStatus
= None¶
-
-
class
StorageSystem
(id=None, parent_id=None, title=None, restricted=False, creator=None)[source]¶ Bases:
coherence.upnp.core.DIDLLite.Container
-
upnp_class
= 'object.container.storageSystem'¶
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
album
= None¶
-
albumArtURI
= None¶
-
artist
= None¶
-
checkUpdate
()¶
-
childCount
= None¶
-
createClass
= None¶
-
creator
= None¶
-
critical
(message, *args, **kwargs)¶
-
date
= None¶
-
debug
(message, *args, **kwargs)¶
-
description
= None¶
-
elementName
= 'container'¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
fromElement
(elt)¶ TODO: * creator * writeStatus
-
classmethod
fromString
(data)¶
-
genre
= None¶
-
genres
= None¶
-
info
(message, *args, **kwargs)¶
-
log
(message, *args, **kwargs)¶
-
logCategory
= 'didllite'¶
-
longDescription
= None¶
-
msg
(message, *args, **kwargs)¶
-
originalTrackNumber
= None¶
-
refID
= None¶
-
res
= None¶
-
searchable
= None¶
-
server_uuid
= None¶
-
toElement
(**kwargs)¶
-
toString
(**kwargs)¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
writeStatus
= None¶
-
-
class
StorageVolume
(id=None, parent_id=None, title=None, restricted=False, creator=None)[source]¶ Bases:
coherence.upnp.core.DIDLLite.Container
-
upnp_class
= 'object.container.storageVolume'¶
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
album
= None¶
-
albumArtURI
= None¶
-
artist
= None¶
-
checkUpdate
()¶
-
childCount
= None¶
-
createClass
= None¶
-
creator
= None¶
-
critical
(message, *args, **kwargs)¶
-
date
= None¶
-
debug
(message, *args, **kwargs)¶
-
description
= None¶
-
elementName
= 'container'¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
fromElement
(elt)¶ TODO: * creator * writeStatus
-
classmethod
fromString
(data)¶
-
genre
= None¶
-
genres
= None¶
-
info
(message, *args, **kwargs)¶
-
log
(message, *args, **kwargs)¶
-
logCategory
= 'didllite'¶
-
longDescription
= None¶
-
msg
(message, *args, **kwargs)¶
-
originalTrackNumber
= None¶
-
refID
= None¶
-
res
= None¶
-
searchable
= None¶
-
server_uuid
= None¶
-
toElement
(**kwargs)¶
-
toString
(**kwargs)¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
writeStatus
= None¶
-
-
class
StorageFolder
(id=None, parent_id=None, title=None, restricted=False, creator=None)[source]¶ Bases:
coherence.upnp.core.DIDLLite.Container
-
upnp_class
= 'object.container.storageFolder'¶
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
album
= None¶
-
albumArtURI
= None¶
-
artist
= None¶
-
checkUpdate
()¶
-
childCount
= None¶
-
createClass
= None¶
-
creator
= None¶
-
critical
(message, *args, **kwargs)¶
-
date
= None¶
-
debug
(message, *args, **kwargs)¶
-
description
= None¶
-
elementName
= 'container'¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
fromElement
(elt)¶ TODO: * creator * writeStatus
-
classmethod
fromString
(data)¶
-
genre
= None¶
-
genres
= None¶
-
info
(message, *args, **kwargs)¶
-
log
(message, *args, **kwargs)¶
-
logCategory
= 'didllite'¶
-
longDescription
= None¶
-
msg
(message, *args, **kwargs)¶
-
originalTrackNumber
= None¶
-
refID
= None¶
-
res
= None¶
-
searchable
= None¶
-
server_uuid
= None¶
-
toElement
(**kwargs)¶
-
toString
(**kwargs)¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
writeStatus
= None¶
-
-
class
DIDLElement
(upnp_client='', parent_container=None, requested_id=None, transcoding=False)[source]¶ Bases:
coherence.log.LogAble
-
logCategory
= 'didllite'¶
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
critical
(message, *args, **kwargs)¶
-
debug
(message, *args, **kwargs)¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
info
(message, *args, **kwargs)¶
-
log
(message, *args, **kwargs)¶
-
msg
(message, *args, **kwargs)¶
-
toString
()[source]¶ sigh - having that optional preamble here breaks some of the older ContentDirectoryClients
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
coherence.upnp.core.action (module)¶
-
class
Action
(service, name, implementation, arguments_list)[source]¶ Bases:
coherence.log.LogAble
-
logCategory
= 'action'¶
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
critical
(message, *args, **kwargs)¶
-
debug
(message, *args, **kwargs)¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
info
(message, *args, **kwargs)¶
-
log
(message, *args, **kwargs)¶
-
msg
(message, *args, **kwargs)¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
coherence.upnp.core.device (module)¶
-
class
Device
(parent=None, udn=None)[source]¶ Bases:
coherence.log.LogAble
-
logCategory
= 'device'¶
-
unsubscribe_service_subscriptions
()[source]¶ iterate over device’s services and unsubscribe subscriptions
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
critical
(message, *args, **kwargs)¶
-
debug
(message, *args, **kwargs)¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
info
(message, *args, **kwargs)¶
-
log
(message, *args, **kwargs)¶
-
msg
(message, *args, **kwargs)¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
-
class
RootDevice
(infos)[source]¶ Bases:
coherence.upnp.core.device.Device
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
add_service
(service)¶
-
as_dict
()¶
-
as_tuples
()¶
-
critical
(message, *args, **kwargs)¶
-
debug
(message, *args, **kwargs)¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
get_client
()¶
-
get_device_type
()¶
-
get_device_type_version
()¶
-
get_embedded_device_by_type
(type)¶
-
get_embedded_devices
()¶
-
get_friendly_device_type
()¶
-
get_friendly_name
()¶
-
get_id
()¶
-
get_markup_name
()¶
-
get_parent_id
()¶
-
get_presentation_url
()¶
-
get_service_by_type
(type)¶
-
get_services
()¶
-
get_uuid
()¶
-
info
(message, *args, **kwargs)¶
-
log
(message, *args, **kwargs)¶
-
logCategory
= 'device'¶
-
msg
(message, *args, **kwargs)¶
-
parse_device
(d)¶
-
receiver
(*args, **kwargs)¶
-
remove_service_with_usn
(service_usn)¶
-
renew_service_subscriptions
()¶ iterate over device’s services and renew subscriptions
-
service_detection_failed
(device)¶
-
set_client
(client)¶
-
unsubscribe_service_subscriptions
()¶ iterate over device’s services and unsubscribe subscriptions
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
coherence.upnp.core.event (module)¶
-
class
EventServer
(control_point)[source]¶ Bases:
twisted.web.resource.Resource
,coherence.log.LogAble
-
logCategory
= 'event_server'¶
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
critical
(message, *args, **kwargs)¶
-
debug
(message, *args, **kwargs)¶
-
delEntity
(name)¶
-
entityType
= <InterfaceClass twisted.web.resource.IResource>¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
getChild
(path, request)¶ Retrieve a ‘child’ resource from me.
Implement this to create dynamic resource generation – resources which are always available may be registered with self.putChild().
This will not be called if the class-level variable ‘isLeaf’ is set in your subclass; instead, the ‘postpath’ attribute of the request will be left as a list of the remaining path elements.
For example, the URL /foo/bar/baz will normally be:
| site.resource.getChild('foo').getChild('bar').getChild('baz').
However, if the resource returned by ‘bar’ has isLeaf set to true, then the getChild call will never be made on it.
Parameters and return value have the same meaning and requirements as those defined by L{IResource.getChildWithDefault}.
-
getChildForRequest
(request)¶
-
getChildWithDefault
(path, request)¶ Retrieve a static or dynamically generated child resource from me.
First checks if a resource was added manually by putChild, and then call getChild to check for dynamic resources. Only override if you want to affect behaviour of all child lookups, rather than just dynamic ones.
This will check to see if I have a pre-registered child resource of the given name, and call getChild if I do not.
@see: L{IResource.getChildWithDefault}
-
getDynamicEntity
(name, request)¶
-
getStaticEntity
(name)¶
-
info
(message, *args, **kwargs)¶
-
isLeaf
= 0¶
-
listDynamicEntities
(request=None)¶
-
listDynamicNames
()¶
-
listEntities
()¶
-
listNames
()¶
-
listStaticEntities
()¶
-
listStaticNames
()¶
-
log
(message, *args, **kwargs)¶
-
msg
(message, *args, **kwargs)¶
-
putChild
(path, child)¶ Register a static child.
You almost certainly don’t want ‘/’ in your path. If you intended to have the root of a folder, e.g. /foo/, you want path to be ‘’.
@see: L{IResource.putChild}
-
reallyPutEntity
(name, entity)¶
-
render
(request)¶ Render a given resource. See L{IResource}’s render method.
I delegate to methods of self with the form ‘render_METHOD’ where METHOD is the HTTP that was used to make the request. Examples: render_GET, render_HEAD, render_POST, and so on. Generally you should implement those methods instead of overriding this one.
render_METHOD methods are expected to return a byte string which will be the rendered page, unless the return value is C{server.NOT_DONE_YET}, in which case it is this class’s responsibility to write the results using C{request.write(data)} and then call C{request.finish()}.
Old code that overrides render() directly is likewise expected to return a byte string or NOT_DONE_YET.
@see: L{IResource.render}
-
render_HEAD
(request)¶ Default handling of HEAD method.
I just return self.render_GET(request). When method is HEAD, the framework will handle this correctly.
-
server
= None¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
-
class
EventSubscriptionServer
(service)[source]¶ Bases:
twisted.web.resource.Resource
,coherence.log.LogAble
This class ist the server part on the device side. It listens to subscribe requests and registers the subscriber to send event messages to this device. If an unsubscribe request is received, the subscription is cancelled and no more event messages will be sent.
we receive a subscription request {‘callback’:
‘host’: ‘192.168.213.107:30020’, ‘nt’: ‘upnp:event’, ‘content-length’: ‘0’, ‘timeout’: ‘Second-300’}
modify the callback value callback = callback[1:len(callback)-1] and pack it into a subscriber dict
- {‘uuid:oAQbxiNlyYojCAdznJnC’:
- { ‘callback’: ‘<http://192.168.213.130:9083/BYvZMzfTSQkjHwzOThaP/ConnectionManager>’, ‘created’: 1162374189.257338, ‘timeout’: ‘Second-300’, ‘sid’: ‘uuid:oAQbxiNlyYojCAdznJnC’}}
-
logCategory
= 'event_subscription_server'¶
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
critical
(message, *args, **kwargs)¶
-
debug
(message, *args, **kwargs)¶
-
delEntity
(name)¶
-
entityType
= <InterfaceClass twisted.web.resource.IResource>¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
getChild
(path, request)¶ Retrieve a ‘child’ resource from me.
Implement this to create dynamic resource generation – resources which are always available may be registered with self.putChild().
This will not be called if the class-level variable ‘isLeaf’ is set in your subclass; instead, the ‘postpath’ attribute of the request will be left as a list of the remaining path elements.
For example, the URL /foo/bar/baz will normally be:
| site.resource.getChild('foo').getChild('bar').getChild('baz').
However, if the resource returned by ‘bar’ has isLeaf set to true, then the getChild call will never be made on it.
Parameters and return value have the same meaning and requirements as those defined by L{IResource.getChildWithDefault}.
-
getChildForRequest
(request)¶
-
getChildWithDefault
(path, request)¶ Retrieve a static or dynamically generated child resource from me.
First checks if a resource was added manually by putChild, and then call getChild to check for dynamic resources. Only override if you want to affect behaviour of all child lookups, rather than just dynamic ones.
This will check to see if I have a pre-registered child resource of the given name, and call getChild if I do not.
@see: L{IResource.getChildWithDefault}
-
getDynamicEntity
(name, request)¶
-
getStaticEntity
(name)¶
-
info
(message, *args, **kwargs)¶
-
isLeaf
= 0¶
-
listDynamicEntities
(request=None)¶
-
listDynamicNames
()¶
-
listEntities
()¶
-
listNames
()¶
-
listStaticEntities
()¶
-
listStaticNames
()¶
-
log
(message, *args, **kwargs)¶
-
msg
(message, *args, **kwargs)¶
-
putChild
(path, child)¶ Register a static child.
You almost certainly don’t want ‘/’ in your path. If you intended to have the root of a folder, e.g. /foo/, you want path to be ‘’.
@see: L{IResource.putChild}
-
reallyPutEntity
(name, entity)¶
-
render
(request)¶ Render a given resource. See L{IResource}’s render method.
I delegate to methods of self with the form ‘render_METHOD’ where METHOD is the HTTP that was used to make the request. Examples: render_GET, render_HEAD, render_POST, and so on. Generally you should implement those methods instead of overriding this one.
render_METHOD methods are expected to return a byte string which will be the rendered page, unless the return value is C{server.NOT_DONE_YET}, in which case it is this class’s responsibility to write the results using C{request.write(data)} and then call C{request.finish()}.
Old code that overrides render() directly is likewise expected to return a byte string or NOT_DONE_YET.
@see: L{IResource.render}
-
render_HEAD
(request)¶ Default handling of HEAD method.
I just return self.render_GET(request). When method is HEAD, the framework will handle this correctly.
-
server
= None¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
class
Event
(sid, elements=None, raw=None)[source]¶ Bases:
dict
,coherence.log.LogAble
-
logCategory
= 'event'¶
-
ns
= 'urn:schemas-upnp-org:event-1-0'¶
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
clear
() → None. Remove all items from D.¶
-
copy
() → a shallow copy of D¶
-
critical
(message, *args, **kwargs)¶
-
debug
(message, *args, **kwargs)¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
fromkeys
()¶ Create a new dictionary with keys from iterable and values set to value.
-
get
()¶ Return the value for key if key is in the dictionary, else default.
-
info
(message, *args, **kwargs)¶
-
items
() → a set-like object providing a view on D's items¶
-
keys
() → a set-like object providing a view on D's keys¶
-
log
(message, *args, **kwargs)¶
-
msg
(message, *args, **kwargs)¶
-
pop
(k[, d]) → v, remove specified key and return the corresponding value.¶ If key is not found, d is returned if given, otherwise KeyError is raised
-
popitem
() → (k, v), remove and return some (key, value) pair as a¶ 2-tuple; but raise KeyError if D is empty.
-
setdefault
()¶ Insert key with a value of default if key is not in the dictionary.
Return the value for key if key is in the dictionary, else default.
-
update
([E, ]**F) → None. Update D from dict/iterable E and F.¶ If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
-
values
() → an object providing a view on D's values¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
-
class
EventProtocol
(service, action)[source]¶ Bases:
twisted.internet.protocol.Protocol
,coherence.log.LogAble
-
logCategory
= 'event_protocol'¶
-
connectionMade
()[source]¶ Called when a connection is made.
This may be considered the initializer of the protocol, because it is called when the connection is completed. For clients, this is called once the connection to the server has been established; for servers, this is called after an accept() call stops blocking and a socket has been received. If you need to send any greeting or initial message, do it here.
-
dataReceived
(data)[source]¶ Called whenever data is received.
Use this method to translate to a higher-level message. Usually, some callback will be made upon the receipt of each complete protocol message.
- @param data: a string of indeterminate length. Please keep in mind
- that you will probably need to buffer some data, as partial (or multiple) protocol messages may be received! I recommend that unit tests for protocols call through to this method with differing chunk sizes, down to one byte at a time.
-
connectionLost
(reason)[source]¶ Called when the connection is shut down.
Clear any circular references here, and any external references to this Protocol. The connection has been closed.
@type reason: L{twisted.python.failure.Failure}
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
connected
= 0¶
-
critical
(message, *args, **kwargs)¶
-
debug
(message, *args, **kwargs)¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
info
(message, *args, **kwargs)¶
-
log
(message, *args, **kwargs)¶
-
logPrefix
()¶ Return a prefix matching the class name, to identify log messages related to this protocol instance.
-
makeConnection
(transport)¶ Make a connection to a transport and a server.
This sets the ‘transport’ attribute of this Protocol, and calls the connectionMade() callback.
-
msg
(message, *args, **kwargs)¶
-
transport
= None¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
-
subscribe
(service, action='subscribe')[source]¶ send a subscribe/renewal/unsubscribe request to a service return the device response
-
class
NotificationProtocol
[source]¶ Bases:
twisted.internet.protocol.Protocol
,coherence.log.LogAble
-
logCategory
= 'notification_protocol'¶
-
connectionMade
()[source]¶ Called when a connection is made.
This may be considered the initializer of the protocol, because it is called when the connection is completed. For clients, this is called once the connection to the server has been established; for servers, this is called after an accept() call stops blocking and a socket has been received. If you need to send any greeting or initial message, do it here.
-
dataReceived
(data)[source]¶ Called whenever data is received.
Use this method to translate to a higher-level message. Usually, some callback will be made upon the receipt of each complete protocol message.
- @param data: a string of indeterminate length. Please keep in mind
- that you will probably need to buffer some data, as partial (or multiple) protocol messages may be received! I recommend that unit tests for protocols call through to this method with differing chunk sizes, down to one byte at a time.
-
connectionLost
(reason)[source]¶ Called when the connection is shut down.
Clear any circular references here, and any external references to this Protocol. The connection has been closed.
@type reason: L{twisted.python.failure.Failure}
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
connected
= 0¶
-
critical
(message, *args, **kwargs)¶
-
debug
(message, *args, **kwargs)¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
info
(message, *args, **kwargs)¶
-
log
(message, *args, **kwargs)¶
-
logPrefix
()¶ Return a prefix matching the class name, to identify log messages related to this protocol instance.
-
makeConnection
(transport)¶ Make a connection to a transport and a server.
This sets the ‘transport’ attribute of this Protocol, and calls the connectionMade() callback.
-
msg
(message, *args, **kwargs)¶
-
transport
= None¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
coherence.upnp.core.msearch (module)¶
-
class
MSearch
(ssdp_server, test=False)[source]¶ Bases:
twisted.internet.protocol.DatagramProtocol
,coherence.log.LogAble
-
logCategory
= 'msearch'¶
-
datagramReceived
(data, xxx_todo_changeme)[source]¶ Called when a datagram is received.
@param datagram: the string received from the transport. @param addr: tuple of source of datagram.
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
connectionRefused
()¶ Called due to error from write in connected mode.
Note this is a result of ICMP message generated by previous write.
-
critical
(message, *args, **kwargs)¶
-
debug
(message, *args, **kwargs)¶
-
doStart
()¶ Make sure startProtocol is called.
This will be called by makeConnection(), users should not call it.
-
doStop
()¶ Make sure stopProtocol is called.
This will be called by the port, users should not call it.
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
info
(message, *args, **kwargs)¶
-
log
(message, *args, **kwargs)¶
-
logPrefix
()¶ Return a prefix matching the class name, to identify log messages related to this protocol instance.
-
makeConnection
(transport)¶ Make a connection to a transport and a server.
This sets the ‘transport’ attribute of this DatagramProtocol, and calls the doStart() callback.
-
msg
(message, *args, **kwargs)¶
-
noisy
= True¶
-
numPorts
= 0¶
-
startProtocol
()¶ Called when a transport is connected to this protocol.
Will only be called once, even if multiple ports are connected.
-
stopProtocol
()¶ Called when the transport is disconnected.
Will only be called once, after all ports are disconnected.
-
transport
= None¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
coherence.upnp.core.service (module)¶
-
class
Service
(service_type, service_id, location, control_url, event_sub_url, presentation_url, scpd_url, device)[source]¶ Bases:
coherence.log.LogAble
-
logCategory
= 'service_client'¶
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
critical
(message, *args, **kwargs)¶
-
debug
(message, *args, **kwargs)¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
info
(message, *args, **kwargs)¶
-
log
(message, *args, **kwargs)¶
-
msg
(message, *args, **kwargs)¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
-
class
ServiceServer
(id, version, backend)[source]¶ Bases:
coherence.log.LogAble
-
logCategory
= 'service_server'¶
-
register_vendor_variable
(name, implementation='optional', instance=0, evented='no', data_type='string', dependant_variable=None, default_value=None, allowed_values=None, has_vendor_values=False, allowed_value_range=None, moderated=False)[source]¶ enables a backend to add an own, vendor defined, StateVariable to the service
@ivar name: the name of the new StateVariable @ivar implementation: either ‘optional’ or ‘required’ @ivar instance: the instance number of the service that variable
should be assigned to, usually ‘0’- @ivar evented: boolean, or the special keyword ‘never’ if the variable
- doesn’t show up in a LastChange event too
- @ivar data_type: ‘string’,’boolean’,’bin.base64’ or
- various number formats
- @ivar dependant_variable: the name of another StateVariable that
- depends on this one
- @ivar default_value: the value this StateVariable should have by
- default when created for another instance of in the service
@ivar allowed_values: a C{list} of values this StateVariable can have @ivar has_vendor_values: boolean if there are values outside
the allowed_values list too- @ivar allowed_value_range: a C{dict} of ‘minimum’,’maximum’
- and ‘step’ values
- @ivar moderated: boolean, True if this StateVariable should only be
- evented via a LastChange event
-
register_vendor_action
(name, implementation, arguments=None, needs_callback=True)[source]¶ enables a backend to add an own, vendor defined, Action to the service
@ivar name: the name of the new Action @ivar implementation: either ‘optional’ or ‘required’ @ivar arguments: a C{list} if argument C{tuples},
like (name,direction,relatedStateVariable)- @ivar needs_callback: this Action needs a method in the backend
- or service class
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
critical
(message, *args, **kwargs)¶
-
debug
(message, *args, **kwargs)¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
info
(message, *args, **kwargs)¶
-
log
(message, *args, **kwargs)¶
-
msg
(message, *args, **kwargs)¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
-
class
scpdXML
(server, control=None)[source]¶ Bases:
twisted.web.static.Data
,coherence.log.LogAble
-
logCategory
= 'service_scpdxml'¶
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
critical
(message, *args, **kwargs)¶
-
debug
(message, *args, **kwargs)¶
-
delEntity
(name)¶
-
entityType
= <InterfaceClass twisted.web.resource.IResource>¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
getChild
(path, request)¶ Retrieve a ‘child’ resource from me.
Implement this to create dynamic resource generation – resources which are always available may be registered with self.putChild().
This will not be called if the class-level variable ‘isLeaf’ is set in your subclass; instead, the ‘postpath’ attribute of the request will be left as a list of the remaining path elements.
For example, the URL /foo/bar/baz will normally be:
| site.resource.getChild('foo').getChild('bar').getChild('baz').
However, if the resource returned by ‘bar’ has isLeaf set to true, then the getChild call will never be made on it.
Parameters and return value have the same meaning and requirements as those defined by L{IResource.getChildWithDefault}.
-
getChildForRequest
(request)¶
-
getChildWithDefault
(path, request)¶ Retrieve a static or dynamically generated child resource from me.
First checks if a resource was added manually by putChild, and then call getChild to check for dynamic resources. Only override if you want to affect behaviour of all child lookups, rather than just dynamic ones.
This will check to see if I have a pre-registered child resource of the given name, and call getChild if I do not.
@see: L{IResource.getChildWithDefault}
-
getDynamicEntity
(name, request)¶
-
getStaticEntity
(name)¶
-
info
(message, *args, **kwargs)¶
-
isLeaf
= 0¶
-
listDynamicEntities
(request=None)¶
-
listDynamicNames
()¶
-
listEntities
()¶
-
listNames
()¶
-
listStaticEntities
()¶
-
listStaticNames
()¶
-
log
(message, *args, **kwargs)¶
-
msg
(message, *args, **kwargs)¶
-
putChild
(path, child)¶ Register a static child.
You almost certainly don’t want ‘/’ in your path. If you intended to have the root of a folder, e.g. /foo/, you want path to be ‘’.
@see: L{IResource.putChild}
-
reallyPutEntity
(name, entity)¶
-
render
(request)[source]¶ Render a given resource. See L{IResource}’s render method.
I delegate to methods of self with the form ‘render_METHOD’ where METHOD is the HTTP that was used to make the request. Examples: render_GET, render_HEAD, render_POST, and so on. Generally you should implement those methods instead of overriding this one.
render_METHOD methods are expected to return a byte string which will be the rendered page, unless the return value is C{server.NOT_DONE_YET}, in which case it is this class’s responsibility to write the results using C{request.write(data)} and then call C{request.finish()}.
Old code that overrides render() directly is likewise expected to return a byte string or NOT_DONE_YET.
@see: L{IResource.render}
-
render_GET
(request)¶
-
render_HEAD
(request)¶
-
server
= None¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
-
class
ServiceControl
[source]¶ Bases:
coherence.log.LogAble
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
critical
(message, *args, **kwargs)¶
-
debug
(message, *args, **kwargs)¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
info
(message, *args, **kwargs)¶
-
log
(message, *args, **kwargs)¶
-
logCategory
= 'default'¶
-
msg
(message, *args, **kwargs)¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
get_action_results
(result, action, instance)[source]¶ check for out arguments if yes: check if there are related ones to StateVariables with
non A_ARG_TYPE_ prefix if yes: check if there is a call plugin method for this action
if yes: update StateVariable values with call result if no: get StateVariable values and
add them to result dict
-
coherence.upnp.core.soap_lite (module)¶
SOAP-lite
some simple functions to implement the SOAP msgs needed by UPnP with ElementTree
inspired by ElementSOAP.py
coherence.upnp.core.soap_proxy (module)¶
-
class
SOAPProxy
(url, namespace=None, envelope_attrib=None, header=None, soapaction=None)[source]¶ Bases:
coherence.log.LogAble
A Proxy for making remote SOAP calls.
Based upon twisted.web.soap.Proxy and extracted to remove the SOAPpy dependency
Pass the URL of the remote SOAP server to the constructor.
Use proxy.callRemote(‘foobar’, 1, 2) to call remote method ‘foobar’ with args 1 and 2, proxy.callRemote(‘foobar’, x=1) will call foobar with named argument ‘x’.
-
logCategory
= 'soap'¶
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
critical
(message, *args, **kwargs)¶
-
debug
(message, *args, **kwargs)¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
info
(message, *args, **kwargs)¶
-
log
(message, *args, **kwargs)¶
-
msg
(message, *args, **kwargs)¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
coherence.upnp.core.soap_service (module)¶
-
exception
errorCode
(status)[source]¶ Bases:
Exception
-
args
¶
-
with_traceback
()¶ Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
-
-
class
UPnPPublisher
[source]¶ Bases:
twisted.web.resource.Resource
,coherence.log.LogAble
Based upon twisted.web.soap.SOAPPublisher and extracted to remove the SOAPpy dependency
UPnP requires headers and OUT parameters to be returned in a slightly different way than the SOAPPublisher class does.
Initialize.
-
logCategory
= 'soap'¶
-
isLeaf
= 1¶
-
encoding
= 'UTF-8'¶
-
envelope_attrib
= None¶
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
__init__
()¶ Initialize.
-
critical
(message, *args, **kwargs)¶
-
debug
(message, *args, **kwargs)¶
-
delEntity
(name)¶
-
entityType
= <InterfaceClass twisted.web.resource.IResource>¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
getChild
(path, request)¶ Retrieve a ‘child’ resource from me.
Implement this to create dynamic resource generation – resources which are always available may be registered with self.putChild().
This will not be called if the class-level variable ‘isLeaf’ is set in your subclass; instead, the ‘postpath’ attribute of the request will be left as a list of the remaining path elements.
For example, the URL /foo/bar/baz will normally be:
| site.resource.getChild('foo').getChild('bar').getChild('baz').
However, if the resource returned by ‘bar’ has isLeaf set to true, then the getChild call will never be made on it.
Parameters and return value have the same meaning and requirements as those defined by L{IResource.getChildWithDefault}.
-
getChildForRequest
(request)¶
-
getChildWithDefault
(path, request)¶ Retrieve a static or dynamically generated child resource from me.
First checks if a resource was added manually by putChild, and then call getChild to check for dynamic resources. Only override if you want to affect behaviour of all child lookups, rather than just dynamic ones.
This will check to see if I have a pre-registered child resource of the given name, and call getChild if I do not.
@see: L{IResource.getChildWithDefault}
-
getDynamicEntity
(name, request)¶
-
getStaticEntity
(name)¶
-
info
(message, *args, **kwargs)¶
-
listDynamicEntities
(request=None)¶
-
listDynamicNames
()¶
-
listEntities
()¶
-
listNames
()¶
-
listStaticEntities
()¶
-
listStaticNames
()¶
-
log
(message, *args, **kwargs)¶
-
msg
(message, *args, **kwargs)¶
-
putChild
(path, child)¶ Register a static child.
You almost certainly don’t want ‘/’ in your path. If you intended to have the root of a folder, e.g. /foo/, you want path to be ‘’.
@see: L{IResource.putChild}
-
reallyPutEntity
(name, entity)¶
-
render_HEAD
(request)¶ Default handling of HEAD method.
I just return self.render_GET(request). When method is HEAD, the framework will handle this correctly.
-
server
= None¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
coherence.upnp.core.ssdp (module)¶
-
class
SSDPServer
(test=False, interface='')[source]¶ Bases:
twisted.internet.protocol.DatagramProtocol
,coherence.log.LogAble
A class implementing a SSDP server. The notifyReceived and searchReceived methods are called when the appropriate type of datagram is received by the server.
-
logCategory
= 'ssdp'¶
-
register
(manifestation, usn, st, location, server='Linux, 4.18.0-1-amd64, UPnP/1.0, Cohen3, 0.8.0', cache_control='max-age=1800', silent=False, host=None)[source]¶ Register a service or device that this SSDP server will respond to.
-
notifyReceived
(headers, xxx_todo_changeme1)[source]¶ Process a presence announcement. We just remember the details of the SSDP service announced.
-
discoveryRequest
(headers, xxx_todo_changeme2)[source]¶ Process a discovery request. The response must be sent to the address specified by (host, port).
-
check_valid
()[source]¶ check if the discovered devices are still ok, or if we haven’t received a new discovery response
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
connectionRefused
()¶ Called due to error from write in connected mode.
Note this is a result of ICMP message generated by previous write.
-
critical
(message, *args, **kwargs)¶
-
debug
(message, *args, **kwargs)¶
-
doStart
()¶ Make sure startProtocol is called.
This will be called by makeConnection(), users should not call it.
-
doStop
()¶ Make sure stopProtocol is called.
This will be called by the port, users should not call it.
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
info
(message, *args, **kwargs)¶
-
log
(message, *args, **kwargs)¶
-
logPrefix
()¶ Return a prefix matching the class name, to identify log messages related to this protocol instance.
-
makeConnection
(transport)¶ Make a connection to a transport and a server.
This sets the ‘transport’ attribute of this DatagramProtocol, and calls the doStart() callback.
-
msg
(message, *args, **kwargs)¶
-
noisy
= True¶
-
numPorts
= 0¶
-
startProtocol
()¶ Called when a transport is connected to this protocol.
Will only be called once, even if multiple ports are connected.
-
stopProtocol
()¶ Called when the transport is disconnected.
Will only be called once, after all ports are disconnected.
-
transport
= None¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
coherence.upnp.core.utils (module)¶
-
generalise_boolean
(value)[source]¶ standardize the different boolean incarnations
transform anything that looks like a “True” into a ‘1’, and everything else into a ‘0’
-
generalize_boolean
(value)¶ standardize the different boolean incarnations
transform anything that looks like a “True” into a ‘1’, and everything else into a ‘0’
-
get_ip_address
(ifname)[source]¶ determine the IP address by interface name
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/439094 (c) Paul Cannon Uses the Linux SIOCGIFADDR ioctl to find the IP address associated with a network interface, given the name of that interface, e.g. “eth0”. The address is returned as a string containing a dotted quad.
Updated to work on BSD. OpenBSD and OSX share the same value for SIOCGIFADDR, and its likely that other BSDs do too.
Updated to work on Windows, using the optional Python module netifaces http://alastairs-place.net/netifaces/
Thx Lawrence for that patch!
-
get_host_address
()[source]¶ try to get determine the interface used for the default route, as this is most likely the interface we should bind to (on a single homed host!)
-
class
Request
(*args, **kw)[source]¶ Bases:
twisted.web.server.Request
-
_disconnected
= False¶
-
_encoder
= None¶
-
_forceSSL
= 0¶
-
_handleStar
()[source]¶ Handle receiving a request whose path is ‘*’.
RFC 7231 defines an OPTIONS * request as being something that a client can send as a low-effort way to probe server capabilities or readiness. Rather than bother the user with this, we simply fast-path it back to an empty 200 OK. Any non-OPTIONS verb gets a 405 Method Not Allowed telling the client they can only use OPTIONS.
-
_inFakeHead
= False¶
-
_insecureSession
= None¶
-
_log
¶ A L{Logger} emits log messages to an observer. You should instantiate it as a class or module attribute, as documented in L{this module’s documentation <twisted.logger>}.
@type namespace: L{str} @ivar namespace: the namespace for this logger
@type source: L{object} @ivar source: The object which is emitting events via this logger
@type: L{ILogObserver} @ivar observer: The observer that this logger will send events to.
-
_secureSession
= None¶
-
addAdapter
(adapterClass, ignoreClass=0)¶ Utility method that calls addComponent. I take an adapter class and instantiate it with myself as the first argument.
@return: The adapter instantiated.
-
addComponent
(component, ignoreClass=0)¶ Add a component to me, for all appropriate interfaces.
In order to determine which interfaces are appropriate, the component’s provided interfaces will be scanned.
If the argument ‘ignoreClass’ is True, then all interfaces are considered appropriate.
Otherwise, an ‘appropriate’ interface is one for which its class has been registered as an adapter for my class according to the rules of getComponent.
@return: the list of appropriate interfaces
-
addCookie
(k, v, expires=None, domain=None, path=None, max_age=None, comment=None, secure=None, httpOnly=False, sameSite=None)[source]¶ Set an outgoing HTTP cookie.
In general, you should consider using sessions instead of cookies, see L{twisted.web.server.Request.getSession} and the L{twisted.web.server.Session} class for details.
@param k: cookie name @type k: L{bytes} or L{unicode}
@param v: cookie value @type v: L{bytes} or L{unicode}
- @param expires: cookie expire attribute value in
- “Wdy, DD Mon YYYY HH:MM:SS GMT” format
@type expires: L{bytes} or L{unicode}
@param domain: cookie domain @type domain: L{bytes} or L{unicode}
@param path: cookie path @type path: L{bytes} or L{unicode}
@param max_age: cookie expiration in seconds from reception @type max_age: L{bytes} or L{unicode}
@param comment: cookie comment @type comment: L{bytes} or L{unicode}
- @param secure: direct browser to send the cookie on encrypted
- connections only
@type secure: L{bool}
- @param httpOnly: direct browser not to expose cookies through channels
- other than HTTP (and HTTPS) requests
@type httpOnly: L{bool}
- @param sameSite: One of L{None} (default), C{‘lax’} or C{‘strict’}.
- Direct browsers not to send this cookie on cross-origin requests. Please see: U{https://tools.ietf.org/html/draft-west-first-party-cookies-07}
@type sameSite: L{None}, L{bytes} or L{unicode}
- @raises: L{DeprecationWarning} if an argument is not L{bytes} or
- L{unicode}. L{ValueError} if the value for C{sameSite} is not supported.
-
appRootURL
= None¶
-
args
= None¶
-
chunked
= 0¶
-
clientproto
= b'(no clientproto yet)'¶
-
code
= 200¶
-
code_message
= b'OK'¶
-
connectionLost
(reason)[source]¶ There is no longer a connection for this request to respond over. Clean up anything which can’t be useful anymore.
-
content
= None¶
-
defaultContentType
= b'text/html'¶
-
etag
= None¶
-
finished
= 0¶
-
getAllHeaders
()[source]¶ Return dictionary mapping the names of all received headers to the last value received for each.
Since this method does not return all header information, C{self.requestHeaders.getAllRawHeaders()} may be preferred.
-
getClientAddress
()[source]¶ Return the address of the client who submitted this request.
This may not be a network address (e.g., a server listening on a UNIX domain socket will cause this to return L{UNIXAddress}). Callers must check the type of the returned address.
@since: 18.4
@return: the client’s address. @rtype: L{IAddress}
-
getClientIP
()[source]¶ Return the IP address of the client who submitted this request.
This method is B{deprecated}. Use L{getClientAddress} instead.
@returns: the client IP address @rtype: C{str}
Deprecated in Twisted 18.4.0; please use getClientAddress instead.
-
getComponent
(interface, default=None)¶ Create or retrieve an adapter for the given interface.
If such an adapter has already been created, retrieve it from the cache that this instance keeps of all its adapters. Adapters created through this mechanism may safely store system-specific state.
If you want to register an adapter that will be created through getComponent, but you don’t require (or don’t want) your adapter to be cached and kept alive for the lifetime of this Componentized object, set the attribute ‘temporaryAdapter’ to True on your adapter class.
If you want to automatically register an adapter for all appropriate interfaces (with addComponent), set the attribute ‘multiComponent’ to True on your adapter class.
-
getHeader
(key)[source]¶ Get an HTTP request header.
@type key: C{bytes} @param key: The name of the header to get the value of.
@rtype: C{bytes} or L{None} @return: The value of the specified header, or L{None} if that header
was not present in the request.
-
getHost
()[source]¶ Get my originally requesting transport’s host.
Don’t rely on the ‘transport’ attribute, since Request objects may be copied remotely. For information on this method’s return value, see L{twisted.internet.tcp.Port}.
-
getPassword
()[source]¶ Return the HTTP password sent with this request, if any.
If no password was supplied, return the empty string.
@returns: the HTTP password, if any @rtype: C{bytes}
-
getRequestHostname
()[source]¶ Get the hostname that the user passed in to the request.
This will either use the Host: header (if it is available) or the host we are listening on if the header is unavailable.
@returns: the requested hostname @rtype: C{bytes}
-
getSession
(sessionInterface=None, forceNotSecure=False)[source]¶ Check if there is a session cookie, and if not, create it.
By default, the cookie with be secure for HTTPS requests and not secure for HTTP requests. If for some reason you need access to the insecure cookie from a secure request you can set C{forceNotSecure = True}.
- @param forceNotSecure: Should we retrieve a session that will be
- transmitted over HTTP, even if this L{Request} was delivered over HTTPS?
@type forceNotSecure: L{bool}
-
getStateFor
(jellier)¶
-
getStateToCopy
()¶ Gather state to send when I am serialized for a peer.
I will default to returning self.__dict__. Override this to customize this behavior.
-
getStateToCopyFor
(issuer)[source]¶ Gather state to send when I am serialized for a particular perspective.
I will default to calling L{getStateToCopy}. Override this to customize this behavior.
-
getTypeToCopy
()¶ Determine what type tag to send for me.
By default, send the string representation of my class (package.module.Class); normally this is adequate, but you may override this to change it.
-
getTypeToCopyFor
(perspective)¶ Determine what type tag to send for me.
By default, defer to self.L{getTypeToCopy}() normally this is adequate, but you may override this to change it.
-
getUser
()[source]¶ Return the HTTP user sent with this request, if any.
If no user was supplied, return the empty string.
@returns: the HTTP user, if any @rtype: C{bytes}
-
gotLength
(length)[source]¶ Called when HTTP channel got length of content in this request.
This method is not intended for users.
- @param length: The length of the request body, as indicated by the
- request headers. L{None} if the request headers do not indicate a length.
-
isSecure
()[source]¶ Return L{True} if this request is using a secure transport.
Normally this method returns L{True} if this request’s L{HTTPChannel} instance is using a transport that implements L{interfaces.ISSLTransport}.
This will also return L{True} if L{Request.setHost} has been called with C{ssl=True}.
@returns: L{True} if this request is secure @rtype: C{bool}
-
jellyFor
(jellier)¶ Assemble type tag and state to copy for this broker.
This will call L{getTypeToCopyFor} and L{getStateToCopy}, and return an appropriate s-expression to represent me.
-
lastModified
= None¶
-
locateAdapterClass
(klass, interfaceClass, default)¶
-
method
= '(no method yet)'¶
-
noLongerQueued
()[source]¶ Notify the object that it is no longer queued.
We start writing whatever data we have to the transport, etc.
This method is not intended for users.
In 16.3 this method was changed to become a no-op, as L{Request} objects are now never queued.
Deprecated in Twisted 16.3.0.
-
notifyFinish
()[source]¶ Notify when the response to this request has finished.
- @note: There are some caveats around the reliability of the delivery of
this notification.
- If this L{Request}’s channel is paused, the notification will not be delivered. This can happen in one of two ways; either you can call C{request.transport.pauseProducing} yourself, or,
- In order to deliver this notification promptly when a client disconnects, the reactor must continue reading from the transport, so that it can tell when the underlying network connection has gone away. Twisted Web will only keep reading up until a finite (small) maximum buffer size before it gives up and pauses the transport itself. If this occurs, you will not discover that the connection has gone away until a timeout fires or until the application attempts to send some data via L{Request.write}.
- It is theoretically impossible to distinguish between successfully I{sending} a response and the peer successfully I{receiving} it. There are several networking edge cases where the L{Deferred}s returned by C{notifyFinish} will indicate success, but the data will never be received. There are also edge cases where the connection will appear to fail, but in reality the response was delivered. As a result, the information provided by the result of the L{Deferred}s returned by this method should be treated as a guess; do not make critical decisions in your applications based upon it.
@rtype: L{Deferred} @return: A L{Deferred} which will be triggered when the request is
finished – with a L{None} value if the request finishes successfully or with an error if the request is interrupted by an error (for example, the client closing the connection prematurely).
-
path
= None¶
-
persistenceVersion
= 1¶
-
processUniqueID
()¶ Return an ID which uniquely represents this object for this process.
By default, this uses the ‘id’ builtin, but can be overridden to indicate that two values are identity-equivalent (such as proxies for the same object).
-
processingFailed
(reason)[source]¶ Finish this request with an indication that processing failed and possibly display a traceback.
@param reason: Reason this request has failed. @type reason: L{twisted.python.failure.Failure}
@return: The reason passed to this method. @rtype: L{twisted.python.failure.Failure}
-
producer
= None¶
-
redirect
(url)[source]¶ Utility function that does a redirect.
The request should have finish() called after this.
-
removeComponent
(component)¶ Remove the given component from me entirely, for all interfaces for which it has been registered.
@return: a list of the interfaces that were removed.
-
render
(resrc)[source]¶ Ask a resource to render itself.
@param resrc: a L{twisted.web.resource.IResource}.
-
requestReceived
(command, path, version)[source]¶ Called by channel when all data has been received.
This method is not intended for users.
@type command: C{bytes} @param command: The HTTP verb of this request. This has the case
supplied by the client (eg, it maybe “get” rather than “GET”).@type path: C{bytes} @param path: The URI of this request.
@type version: C{bytes} @param version: The HTTP version of this request.
-
sentLength
= 0¶
-
session
¶ If a session has already been created or looked up with L{Request.getSession}, this will return that object. (This will always be the session that matches the security of the request; so if C{forceNotSecure} is used on a secure request, this will not return that session.)
@return: the session attribute @rtype: L{Session} or L{None}
-
setAdapter
(interfaceClass, adapterClass)¶ Cache a provider for the given interface, by adapting C{self} using the given adapter class.
-
setComponent
(interfaceClass, component)¶ Cache a provider of the given interface.
-
setETag
(etag)[source]¶ Set an C{entity tag} for the outgoing response.
That’s “entity tag” as in the HTTP/1.1 C{ETag} header, “used for comparing two or more entities from the same requested resource.”
If I am a conditional request, I may modify my response code to L{NOT_MODIFIED} or L{PRECONDITION_FAILED}, if appropriate for the tag given.
@param etag: The entity tag for the resource being returned. @type etag: string @return: If I am a C{If-None-Match} conditional request and
the tag matches one in the request, I return L{http.CACHED<CACHED>} to indicate that you should write no body. Otherwise, I return a false value.
-
setHeader
(name, value)[source]¶ Set an HTTP response header. Overrides any previously set values for this header.
@type name: C{bytes} @param name: The name of the header for which to set the value.
@type value: C{bytes} @param value: The value to set for the named header.
-
setHost
(host, port, ssl=0)[source]¶ Change the host and port the request thinks it’s using.
This method is useful for working with reverse HTTP proxies (e.g. both Squid and Apache’s mod_proxy can do this), when the address the HTTP client is using is different than the one we’re listening on.
For example, Apache may be listening on https://www.example.com/, and then forwarding requests to http://localhost:8080/, but we don’t want HTML produced by Twisted to say b’http://localhost:8080/’, they should say b’https://www.example.com/’, so we do:
request.setHost(b'www.example.com', 443, ssl=1)
@type host: C{bytes} @param host: The value to which to change the host header.
@type ssl: C{bool} @param ssl: A flag which, if C{True}, indicates that the request is
considered secure (if C{True}, L{isSecure} will return C{True}).
-
setLastModified
(when)[source]¶ Set the C{Last-Modified} time for the response to this request.
If I am called more than once, I ignore attempts to set Last-Modified earlier, only replacing the Last-Modified time if it is to a later value.
If I am a conditional request, I may modify my response code to L{NOT_MODIFIED} if appropriate for the time given.
- @param when: The last time the resource being returned was
- modified, in seconds since the epoch.
@type when: number @return: If I am a C{If-Modified-Since} conditional request and
the time given is not newer than the condition, I return L{http.CACHED<CACHED>} to indicate that you should write no body. Otherwise, I return a false value.
-
setResponseCode
(code, message=None)[source]¶ Set the HTTP response code.
@type code: C{int} @type message: C{bytes}
-
site
= None¶
-
startedWriting
= 0¶
-
unsetComponent
(interfaceClass)¶ Remove my component specified by the given interface class.
-
uri
= '(no uri yet)'¶
-
view_registerProducer
(issuer, producer, streaming)[source]¶ Remote version of registerProducer; same interface. (requires a remote producer.)
-
-
class
Site
(resource, requestFactory=None, *args, **kwargs)[source]¶ Bases:
twisted.web.server.Site
- @param resource: The root of the resource hierarchy. All request
- traversal for requests received by this factory will begin at this resource.
@type resource: L{IResource} provider @param requestFactory: Overwrite for default requestFactory. @type requestFactory: C{callable} or C{class}.
@see: L{twisted.web.http.HTTPFactory.__init__}
-
noisy
= False¶
-
__init__
(resource, requestFactory=None, *args, **kwargs)[source]¶ - @param resource: The root of the resource hierarchy. All request
- traversal for requests received by this factory will begin at this resource.
@type resource: L{IResource} provider @param requestFactory: Overwrite for default requestFactory. @type requestFactory: C{callable} or C{class}.
@see: L{twisted.web.http.HTTPFactory.__init__}
-
_entropy
()¶ Return a bytes object containing random bytes suitable for cryptographic use.
-
_updateLogDateTime
()¶ Update log datetime periodically, so we aren’t always recalculating it.
-
counter
= 0¶
-
displayTracebacks
= True¶
-
doStart
()¶ Make sure startFactory is called.
Users should not call this function themselves!
-
doStop
()¶ Make sure stopFactory is called.
Users should not call this function themselves!
-
classmethod
forProtocol
(protocol, *args, **kwargs)¶ Create a factory for the given protocol.
It sets the C{protocol} attribute and returns the constructed factory instance.
@param protocol: A L{Protocol} subclass
@param args: Positional arguments for the factory.
@param kwargs: Keyword arguments for the factory.
@return: A L{Factory} instance wired up to C{protocol}.
-
getResourceFor
(request)[source]¶ Get a resource for a request.
This iterates through the resource hierarchy, calling getChildWithDefault on each resource it finds for a path element, stopping when it hits an element where isLeaf is true.
-
getSession
(uid)[source]¶ Get a previously generated session.
@param uid: Unique ID of the session. @type uid: L{bytes}.
@raise: L{KeyError} if the session is not found.
-
isLeaf
= 0¶
-
log
(request)¶ Write a line representing C{request} to the access log file.
@param request: The request object about which to log. @type request: L{Request}
-
logPath
= None¶
-
logPrefix
()¶ Describe this factory for log messages.
-
numPorts
= 0¶
-
protocol
()¶ Returns an appropriately initialized _GenericHTTPChannelProtocol.
-
sessionCheckTime
= 1800¶
-
sessionFactory
¶ alias of
twisted.web.server.Session
-
stopFactory
()¶ This will be called before I stop listening on all Ports/Connectors.
This can be overridden to perform ‘shutdown’ tasks such as disconnecting database connections, closing files, etc.
It will be called, for example, before an application shuts down, if it was connected to a port. User code should not call this function directly.
-
timeOut
= 60¶
-
class
ProxyClient
(command, rest, version, headers, data, father)[source]¶ Bases:
twisted.web.proxy.ProxyClient
,coherence.log.LogAble
-
handleStatus
(version, code, message)[source]¶ Called when the status-line is received.
@param version: e.g. ‘HTTP/1.0’ @param status: e.g. ‘200’ @type status: C{bytes} @param message: e.g. ‘OK’
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
MAX_LENGTH
= 16384¶
-
_HTTPClient__buffer
= None¶
-
_Loggable__logger
= None¶
-
_buffer
= b''¶
-
_busyReceiving
= False¶
-
_finished
= False¶
-
_header
= b''¶
-
clearLineBuffer
()¶ Clear buffered data.
@return: All of the cleared buffered data. @rtype: C{bytes}
-
connected
= 0¶
-
connectionLost
(reason)¶ Called when the connection is shut down.
Clear any circular references here, and any external references to this Protocol. The connection has been closed.
@type reason: L{twisted.python.failure.Failure}
-
connectionMade
()[source]¶ Called when a connection is made.
This may be considered the initializer of the protocol, because it is called when the connection is completed. For clients, this is called once the connection to the server has been established; for servers, this is called after an accept() call stops blocking and a socket has been received. If you need to send any greeting or initial message, do it here.
-
critical
(message, *args, **kwargs)¶
-
dataReceived
(data)¶ Protocol.dataReceived. Translates bytes into lines, and calls lineReceived (or rawDataReceived, depending on mode.)
-
debug
(message, *args, **kwargs)¶
-
delimiter
= b'\r\n'¶
-
endHeaders
()¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
extractHeader
(header)¶ Given a complete HTTP header, extract the field name and value and process the header.
- @param header: a complete HTTP request header of the form
- ‘field-name: value’.
@type header: C{bytes}
-
fatal
(message, *args, **kwargs)¶
-
firstLine
= True¶
-
handleEndHeaders
()¶ Called when all headers have been received.
-
handleResponseEnd
()[source]¶ Finish the original request, indicating that the response has been completely written to it, and disconnect the outgoing transport.
-
info
(message, *args, **kwargs)¶
-
length
= None¶
-
lineLengthExceeded
(line)¶ Called when the maximum line length has been reached. Override if it needs to be dealt with in some special way.
The argument ‘line’ contains the remainder of the buffer, starting with (at least some part) of the line which is too long. This may be more than one line, or may be only the initial portion of the line.
-
lineReceived
(line)¶ Parse the status line and headers for an HTTP request.
- @param line: Part of an HTTP request header. Request bodies are parsed
- in L{HTTPClient.rawDataReceived}.
@type line: C{bytes}
-
line_mode
= 1¶
-
log
(message, *args, **kwargs)¶
-
logCategory
= 'default'¶
-
logPrefix
()¶ Return a prefix matching the class name, to identify log messages related to this protocol instance.
-
makeConnection
(transport)¶ Make a connection to a transport and a server.
This sets the ‘transport’ attribute of this Protocol, and calls the connectionMade() callback.
-
msg
(message, *args, **kwargs)¶
-
pauseProducing
()¶
-
paused
= False¶
-
rawDataReceived
(data)¶ Override this for when raw data is received.
-
resumeProducing
()¶
-
sendCommand
(command, path)¶
-
sendHeader
(name, value)¶
-
sendLine
(line)¶ Sends a line to the other end of the connection.
@param line: The line to send, not including the delimiter. @type line: C{bytes}
-
setLineMode
(extra=b'')¶ Sets the line-mode of this receiver.
If you are calling this from a rawDataReceived callback, you can pass in extra unhandled data, and that data will be parsed for lines. Further data received will be sent to lineReceived rather than rawDataReceived.
Do not pass extra data if calling this function from within a lineReceived callback.
-
setRawMode
()¶ Sets the raw mode of this receiver. Further data received will be sent to rawDataReceived rather than lineReceived.
-
stopProducing
()¶
-
transport
= None¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-
-
class
ProxyClientFactory
(command, rest, version, headers, data, father)[source]¶ Bases:
twisted.web.proxy.ProxyClientFactory
-
protocol
¶ alias of
twisted.web.proxy.ProxyClient
-
buildProtocol
(addr)[source]¶ Create an instance of a subclass of Protocol.
The returned instance will handle input on an incoming server connection, and an attribute “factory” pointing to the creating factory.
Alternatively, L{None} may be returned to immediately close the new connection.
Override this method to alter how Protocol instances get created.
@param addr: an object implementing L{twisted.internet.interfaces.IAddress}
-
clientConnectionFailed
(connector, reason)[source]¶ Report a connection failure in a response to the incoming request as an error.
-
clientConnectionLost
(connector, reason)¶ Called when an established connection is lost.
It may be useful to call connector.connect() - this will reconnect.
@type reason: L{twisted.python.failure.Failure}
-
doStart
()¶ Make sure startFactory is called.
Users should not call this function themselves!
-
doStop
()¶ Make sure stopFactory is called.
Users should not call this function themselves!
-
classmethod
forProtocol
(protocol, *args, **kwargs)¶ Create a factory for the given protocol.
It sets the C{protocol} attribute and returns the constructed factory instance.
@param protocol: A L{Protocol} subclass
@param args: Positional arguments for the factory.
@param kwargs: Keyword arguments for the factory.
@return: A L{Factory} instance wired up to C{protocol}.
-
logPrefix
()¶ Describe this factory for log messages.
-
noisy
= True¶
-
numPorts
= 0¶
-
startFactory
()¶ This will be called before I begin listening on a Port or Connector.
It will only be called once, even if the factory is connected to multiple ports.
This can be used to perform ‘unserialization’ tasks that are best put off until things are actually running, such as connecting to a database, opening files, etcetera.
-
startedConnecting
(connector)¶ Called when a connection has been started.
You can call connector.stopConnecting() to stop the connection attempt.
@param connector: a Connector object.
-
stopFactory
()¶ This will be called before I stop listening on all Ports/Connectors.
This can be overridden to perform ‘shutdown’ tasks such as disconnecting database connections, closing files, etc.
It will be called, for example, before an application shuts down, if it was connected to a port. User code should not call this function directly.
-
-
class
ReverseProxyResource
(host, port, path, reactor=<twisted.internet.epollreactor.EPollReactor object>)[source]¶ Bases:
twisted.web.proxy.ReverseProxyResource
Resource that renders the results gotten from another server
Put this resource in the tree to cause everything below it to be relayed to a different server.
- @ivar proxyClientFactoryClass: a proxy client factory class, used to create
- new connections.
@type proxyClientFactoryClass: L{ClientFactory}
@ivar reactor: the reactor used to create connections. @type reactor: object providing L{twisted.internet.interfaces.IReactorTCP}
@param host: the host of the web server to proxy. @type host: C{str}
@param port: the port of the web server to proxy. @type port: C{port}
- @param path: the base path to fetch data from. Note that you shouldn’t
- put any trailing slashes in it, it will be added automatically in request. For example, if you put B{/foo}, a request on B{/bar} will be proxied to B{/foo/bar}.
@type path: C{str}
-
proxyClientFactoryClass
¶ alias of
ProxyClientFactory
-
__init__
(host, port, path, reactor=<twisted.internet.epollreactor.EPollReactor object>)[source]¶ @param host: the host of the web server to proxy. @type host: C{str}
@param port: the port of the web server to proxy. @type port: C{port}
- @param path: the base path to fetch data from. Note that you shouldn’t
- put any trailing slashes in it, it will be added automatically in request. For example, if you put B{/foo}, a request on B{/bar} will be proxied to B{/foo/bar}.
@type path: C{str}
-
getChild
(path, request)[source]¶ Create and return a proxy resource with the same proxy configuration as this one, except that its path also contains the segment given by C{path} at the end.
-
delEntity
(name)¶
-
entityType
= <InterfaceClass twisted.web.resource.IResource>¶
-
getChildForRequest
(request)¶
-
getChildWithDefault
(path, request)¶ Retrieve a static or dynamically generated child resource from me.
First checks if a resource was added manually by putChild, and then call getChild to check for dynamic resources. Only override if you want to affect behaviour of all child lookups, rather than just dynamic ones.
This will check to see if I have a pre-registered child resource of the given name, and call getChild if I do not.
@see: L{IResource.getChildWithDefault}
-
getDynamicEntity
(name, request)¶
-
getStaticEntity
(name)¶
-
isLeaf
= 0¶
-
listDynamicEntities
(request=None)¶
-
listDynamicNames
()¶
-
listEntities
()¶
-
listNames
()¶
-
listStaticEntities
()¶
-
listStaticNames
()¶
-
putChild
(path, child)¶ Register a static child.
You almost certainly don’t want ‘/’ in your path. If you intended to have the root of a folder, e.g. /foo/, you want path to be ‘’.
@see: L{IResource.putChild}
-
reallyPutEntity
(name, entity)¶
-
render_HEAD
(request)¶ Default handling of HEAD method.
I just return self.render_GET(request). When method is HEAD, the framework will handle this correctly.
-
server
= None¶
-
class
ReverseProxyUriResource
(uri, reactor=<twisted.internet.epollreactor.EPollReactor object>)[source]¶ Bases:
coherence.upnp.core.utils.ReverseProxyResource
-
uri
= None¶
-
delEntity
(name)¶
-
entityType
= <InterfaceClass twisted.web.resource.IResource>¶
-
getChild
(path, request)¶ Create and return a proxy resource with the same proxy configuration as this one, except that its path also contains the segment given by C{path} at the end.
-
getChildForRequest
(request)¶
-
getChildWithDefault
(path, request)¶ Retrieve a static or dynamically generated child resource from me.
First checks if a resource was added manually by putChild, and then call getChild to check for dynamic resources. Only override if you want to affect behaviour of all child lookups, rather than just dynamic ones.
This will check to see if I have a pre-registered child resource of the given name, and call getChild if I do not.
@see: L{IResource.getChildWithDefault}
-
getDynamicEntity
(name, request)¶
-
getStaticEntity
(name)¶
-
isLeaf
= 0¶
-
listDynamicEntities
(request=None)¶
-
listDynamicNames
()¶
-
listEntities
()¶
-
listNames
()¶
-
listStaticEntities
()¶
-
listStaticNames
()¶
-
proxyClientFactoryClass
¶ alias of
ProxyClientFactory
-
putChild
(path, child)¶ Register a static child.
You almost certainly don’t want ‘/’ in your path. If you intended to have the root of a folder, e.g. /foo/, you want path to be ‘’.
@see: L{IResource.putChild}
-
reallyPutEntity
(name, entity)¶
-
render
(request)¶ Render a request by forwarding it to the proxied server.
-
render_HEAD
(request)¶ Default handling of HEAD method.
I just return self.render_GET(request). When method is HEAD, the framework will handle this correctly.
-
resetTarget
(host, port, path, qs='')¶
-
server
= None¶
-
-
class
myHTTPPageGetter
[source]¶ Bases:
twisted.web.client.HTTPPageGetter
-
followRedirect
= True¶
-
MAX_LENGTH
= 16384¶
-
_HTTPClient__buffer
= None¶
-
_buffer
= b''¶
-
_busyReceiving
= False¶
-
_completelyDone
= True¶
-
_header
= b''¶
-
_specialHeaders
= {b'content-length', b'cookie', b'host', b'user-agent'}¶
-
clearLineBuffer
()¶ Clear buffered data.
@return: All of the cleared buffered data. @rtype: C{bytes}
-
connected
= 0¶
-
connectionLost
(reason)¶ When the connection used to issue the HTTP request is closed, notify the factory if we have not already, so it can produce a result.
-
connectionMade
()¶ Called when a connection is made.
This may be considered the initializer of the protocol, because it is called when the connection is completed. For clients, this is called once the connection to the server has been established; for servers, this is called after an accept() call stops blocking and a socket has been received. If you need to send any greeting or initial message, do it here.
-
dataReceived
(data)¶ Protocol.dataReceived. Translates bytes into lines, and calls lineReceived (or rawDataReceived, depending on mode.)
-
delimiter
= b'\r\n'¶
-
endHeaders
()¶
-
extractHeader
(header)¶ Given a complete HTTP header, extract the field name and value and process the header.
- @param header: a complete HTTP request header of the form
- ‘field-name: value’.
@type header: C{bytes}
-
failed
= 0¶
-
firstLine
= True¶
-
handleEndHeaders
()¶ Called when all headers have been received.
-
handleHeader
(key, value)¶ Called every time a header is received. Stores the header information as key-value pairs in the C{headers} attribute.
@type key: C{str} @param key: An HTTP header field name.
@type value: C{str} @param value: An HTTP header field value.
-
handleResponse
(response)¶
-
handleResponseEnd
()¶ The response has been completely received.
This callback may be invoked more than once per request.
-
handleResponsePart
(data)¶
-
handleStatus
(version, status, message)¶ Handle the HTTP status line.
@param version: The HTTP version. @type version: L{bytes} @param status: The HTTP status code, an integer represented as a
bytestring.@type status: L{bytes} @param message: The HTTP status message. @type message: L{bytes}
-
handleStatusDefault
()¶
-
handleStatus_200
()¶
-
handleStatus_201
()¶
-
handleStatus_202
()¶
-
handleStatus_301
()¶
-
handleStatus_302
()¶
-
handleStatus_303
()¶
-
length
= None¶
-
lineLengthExceeded
(line)¶ Called when the maximum line length has been reached. Override if it needs to be dealt with in some special way.
The argument ‘line’ contains the remainder of the buffer, starting with (at least some part) of the line which is too long. This may be more than one line, or may be only the initial portion of the line.
-
lineReceived
(line)¶ Parse the status line and headers for an HTTP request.
- @param line: Part of an HTTP request header. Request bodies are parsed
- in L{HTTPClient.rawDataReceived}.
@type line: C{bytes}
-
line_mode
= 1¶
-
logPrefix
()¶ Return a prefix matching the class name, to identify log messages related to this protocol instance.
-
makeConnection
(transport)¶ Make a connection to a transport and a server.
This sets the ‘transport’ attribute of this Protocol, and calls the connectionMade() callback.
-
pauseProducing
()¶
-
paused
= False¶
-
quietLoss
= 0¶
-
rawDataReceived
(data)¶ Override this for when raw data is received.
-
resumeProducing
()¶
-
sendCommand
(command, path)¶
-
sendHeader
(name, value)¶
-
sendLine
(line)¶ Sends a line to the other end of the connection.
@param line: The line to send, not including the delimiter. @type line: C{bytes}
-
setLineMode
(extra=b'')¶ Sets the line-mode of this receiver.
If you are calling this from a rawDataReceived callback, you can pass in extra unhandled data, and that data will be parsed for lines. Further data received will be sent to lineReceived rather than rawDataReceived.
Do not pass extra data if calling this function from within a lineReceived callback.
-
setRawMode
()¶ Sets the raw mode of this receiver. Further data received will be sent to rawDataReceived rather than lineReceived.
-
stopProducing
()¶
-
timeout
()¶
-
transport
= None¶
-
-
class
HeaderAwareHTTPClientFactory
(url, method=b'GET', postdata=None, headers=None, agent=b'Twisted PageGetter', timeout=0, cookies=None, followRedirect=True, redirectLimit=20, afterFoundGet=False)[source]¶ Bases:
twisted.web.client.HTTPClientFactory
-
protocol
¶ alias of
myHTTPPageGetter
-
noisy
= False¶
-
buildProtocol
(addr)[source]¶ Create an instance of a subclass of Protocol.
The returned instance will handle input on an incoming server connection, and an attribute “factory” pointing to the creating factory.
Alternatively, L{None} may be returned to immediately close the new connection.
Override this method to alter how Protocol instances get created.
@param addr: an object implementing L{twisted.internet.interfaces.IAddress}
-
_cancelTimeout
(result, timeoutCall)¶
-
_waitForDisconnect
(passthrough)¶ Chain onto the _disconnectedDeferred, preserving C{passthrough}, so that the result is only available after the associated connection has been closed.
-
clientConnectionFailed
(_, reason)¶ When a connection attempt fails, the request cannot be issued. If no result has yet been provided to the result Deferred, provide the connection failure reason as an error result.
-
clientConnectionLost
(connector, reason)¶ Called when an established connection is lost.
It may be useful to call connector.connect() - this will reconnect.
@type reason: L{twisted.python.failure.Failure}
-
doStart
()¶ Make sure startFactory is called.
Users should not call this function themselves!
-
doStop
()¶ Make sure stopFactory is called.
Users should not call this function themselves!
-
classmethod
forProtocol
(protocol, *args, **kwargs)¶ Create a factory for the given protocol.
It sets the C{protocol} attribute and returns the constructed factory instance.
@param protocol: A L{Protocol} subclass
@param args: Positional arguments for the factory.
@param kwargs: Keyword arguments for the factory.
@return: A L{Factory} instance wired up to C{protocol}.
-
gotHeaders
(headers)¶ Parse the response HTTP headers.
@param headers: The response HTTP headers. @type headers: L{dict}
-
gotStatus
(version, status, message)¶ Set the status of the request on us.
@param version: The HTTP version. @type version: L{bytes} @param status: The HTTP status code, an integer represented as a
bytestring.@type status: L{bytes} @param message: The HTTP status message. @type message: L{bytes}
-
host
= b''¶
-
logPrefix
()¶ Describe this factory for log messages.
-
noPage
(reason)¶
-
numPorts
= 0¶
-
path
= None¶
-
port
= None¶
-
scheme
= None¶
-
setURL
(url)¶
-
startFactory
()¶ This will be called before I begin listening on a Port or Connector.
It will only be called once, even if the factory is connected to multiple ports.
This can be used to perform ‘unserialization’ tasks that are best put off until things are actually running, such as connecting to a database, opening files, etcetera.
-
startedConnecting
(connector)¶ Called when a connection has been started.
You can call connector.stopConnecting() to stop the connection attempt.
@param connector: a Connector object.
-
stopFactory
()¶ This will be called before I stop listening on all Ports/Connectors.
This can be overridden to perform ‘shutdown’ tasks such as disconnecting database connections, closing files, etc.
It will be called, for example, before an application shuts down, if it was connected to a port. User code should not call this function directly.
-
url
= None¶
-
-
getPage
(url, contextFactory=None, *args, **kwargs)[source]¶ Download a web page as a string.
Download a page. Return a deferred, which will callback with a page (as a string) or errback with a description of the error.
See HTTPClientFactory to see what extra args can be passed.
-
downloadPage
(url, file, contextFactory=None, *args, **kwargs)[source]¶ Download a web page to a file.
@param file: path to file on filesystem, or file-like object.
See twisted.web.client.HTTPDownloader to see what extra args can be passed.
-
class
BufferFile
(path, target_size=0, *args)[source]¶ Bases:
twisted.web.static.File
taken from twisted.web.static and modified accordingly to the patch by John-Mark Gurney http://resnet.uoregon.edu/~gurney_j/jmpc/dist/twisted.web.static.patch
-
render
(request)[source]¶ Render a given resource. See L{IResource}’s render method.
I delegate to methods of self with the form ‘render_METHOD’ where METHOD is the HTTP that was used to make the request. Examples: render_GET, render_HEAD, render_POST, and so on. Generally you should implement those methods instead of overriding this one.
render_METHOD methods are expected to return a byte string which will be the rendered page, unless the return value is C{server.NOT_DONE_YET}, in which case it is this class’s responsibility to write the results using C{request.write(data)} and then call C{request.finish()}.
Old code that overrides render() directly is likewise expected to return a byte string or NOT_DONE_YET.
@see: L{IResource.render}
-
_asBytesPath
(encoding=None)¶ Return the path of this L{FilePath} as bytes.
- @param encoding: The encoding to use if coercing to L{bytes}. If none is
- given, L{sys.getfilesystemencoding} is used.
@return: L{bytes}
-
_asTextPath
(encoding=None)¶ Return the path of this L{FilePath} as text.
- @param encoding: The encoding to use if coercing to L{unicode}. If none
- is given, L{sys.getfilesystemencoding} is used.
@return: L{unicode}
-
_chunkSize
= 65536¶
-
_contentRange
(offset, size)¶ Return a string suitable for the value of a Content-Range header for a range with the given offset and size.
The offset and size are not sanity checked in any way.
@param offset: How far into this resource the range begins. @param size: How long the range is. @return: The value as appropriate for the value of a Content-Range
header.
-
_doMultipleRangeRequest
(request, byteRanges)¶ Set up the response for Range headers that specify a single range.
This method checks if the request is satisfiable and sets the response code and Content-Type and Content-Length headers appropriately. The return value, which is a little complicated, indicates which parts of the resource to return and the boundaries that should separate the parts.
In detail, the return value is a tuple rangeInfo C{rangeInfo} is a list of 3-tuples C{(partSeparator, partOffset, partSize)}. The response to this request should be, for each element of C{rangeInfo}, C{partSeparator} followed by C{partSize} bytes of the resource starting at C{partOffset}. Each C{partSeparator} includes the MIME-style boundary and the part-specific Content-type and Content-range headers. It is convenient to return the separator as a concrete string from this method, because this method needs to compute the number of bytes that will make up the response to be able to set the Content-Length header of the response accurately.
@param request: The Request object. @param byteRanges: A list of C{(start, end)} values as specified by
the header. For each range, at most one of C{start} and C{end} may be L{None}.@return: See above.
-
_doSingleRangeRequest
(request, startAndEnd)¶ Set up the response for Range headers that specify a single range.
This method checks if the request is satisfiable and sets the response code and Content-Range header appropriately. The return value indicates which part of the resource to return.
@param request: The Request object. @param startAndEnd: A 2-tuple of start of the byte range as specified by
the header and the end of the byte range as specified by the header. At most one of the start and end may be L{None}.- @return: A 2-tuple of the offset and size of the range to return.
- offset == size == 0 indicates that the request is not satisfiable.
-
_getPathAsSameTypeAs
(pattern)¶ If C{pattern} is C{bytes}, return L{FilePath.path} as L{bytes}. Otherwise, return L{FilePath.path} as L{unicode}.
- @param pattern: The new element of the path that L{FilePath.path} may
- need to be coerced to match.
-
_parseRangeHeader
(range)¶ Parse the value of a Range header into (start, stop) pairs.
In a given pair, either of start or stop can be None, signifying that no value was provided, but not both.
@return: A list C{[(start, stop)]} of pairs of length at least one.
- @raise ValueError: if the header is syntactically invalid or if the
- Bytes-Unit is anything other than “bytes’.
-
_rangeToOffsetAndSize
(start, end)¶ Convert a start and end from a Range header to an offset and size.
This method checks that the resulting range overlaps with the resource being served (and so has the value of C{getFileSize()} as an indirect input).
Either but not both of start or end can be L{None}:
- Omitted start means that the end value is actually a start value relative to the end of the resource.
- Omitted end means the end of the resource should be the end of the range.
End is interpreted as inclusive, as per RFC 2616.
If this range doesn’t overlap with any of this resource, C{(0, 0)} is returned, which is not otherwise a value return value.
- @param start: The start value from the header, or L{None} if one was
- not present.
- @param end: The end value from the header, or L{None} if one was not
- present.
- @return: C{(offset, size)} where offset is how far into this resource
- this resource the range begins and size is how long the range is, or C{(0, 0)} if the range does not overlap this resource.
-
_setContentHeaders
(request, size=None)¶ Set the Content-length and Content-type headers for this request.
This method is not appropriate for requests for multiple byte ranges; L{_doMultipleRangeRequest} will set these headers in that case.
@param request: The L{twisted.web.http.Request} object. @param size: The size of the response. If not specified, default to
C{self.getFileSize()}.
-
_statinfo
= None¶
-
asBytesMode
(encoding=None)¶ Return this L{FilePath} in L{bytes}-mode.
- @param encoding: The encoding to use if coercing to L{bytes}. If none is
- given, L{sys.getfilesystemencoding} is used.
@return: L{bytes} mode L{FilePath}
-
asTextMode
(encoding=None)¶ Return this L{FilePath} in L{unicode}-mode.
- @param encoding: The encoding to use if coercing to L{unicode}. If none
- is given, L{sys.getfilesystemencoding} is used.
@return: L{unicode} mode L{FilePath}
-
basename
()¶ Retrieve the final component of the file path’s path (everything after the final path separator).
- @return: The final component of the L{FilePath}’s path (Everything
- after the final path separator).
@rtype: the same type as this L{FilePath}’s C{path} attribute
-
changed
()¶ Clear any cached information about the state of this path on disk.
@since: 10.1.0
-
child
(path)¶ Create and return a new L{FilePath} representing a path contained by C{self}.
- @param path: The base name of the new L{FilePath}. If this contains
- directory separators or parent references it will be rejected.
@type path: L{bytes} or L{unicode}
- @raise InsecurePath: If the result of combining this path with C{path}
- would result in a path which is not a direct child of this path.
@return: The child path. @rtype: L{FilePath} with a mode equal to the type of C{path}.
-
childNotFound
= <twisted.web.resource.NoResource object>¶
-
childSearchPreauth
(*paths)¶ Return my first existing child with a name in C{paths}.
C{paths} is expected to be a list of pre-secured path fragments; in most cases this will be specified by a system administrator and not an arbitrary user.
If no appropriately-named children exist, this will return L{None}.
@return: L{None} or the child path. @rtype: L{None} or L{FilePath}
-
children
()¶ List the children of this path object.
@raise OSError: If an error occurs while listing the directory. If the error is ‘serious’, meaning that the operation failed due to an access violation, exhaustion of some kind of resource (file descriptors or memory), OSError or a platform-specific variant will be raised.
@raise UnlistableError: If the inability to list the directory is due to this path not existing or not being a directory, the more specific OSError subclass L{UnlistableError} is raised instead.
@return: an iterable of all currently-existing children of this object.
-
chmod
(mode)¶ Changes the permissions on self, if possible. Propagates errors from L{os.chmod} up.
- @param mode: integer representing the new permissions desired (same as
- the command line chmod)
@type mode: L{int}
-
clonePath
¶ alias of
twisted.python.filepath.FilePath
-
contentEncodings
= {'.bz2': 'bzip2', '.gz': 'gzip'}¶
-
contentTypes
= {'.%': 'application/x-trash', '.323': 'text/h323', '.3gp': 'video/3gpp', '.7z': 'application/x-7z-compressed', '.a': 'application/octet-stream', '.abw': 'application/x-abiword', '.ai': 'application/postscript', '.aif': 'audio/x-aiff', '.aifc': 'audio/x-aiff', '.aiff': 'audio/x-aiff', '.alc': 'chemical/x-alchemy', '.amr': 'audio/amr', '.anx': 'application/annodex', '.apk': 'application/vnd.android.package-archive', '.appcache': 'text/cache-manifest', '.application': 'application/x-ms-application', '.art': 'image/x-jg', '.asc': 'text/plain', '.asf': 'video/x-ms-asf', '.asn': 'chemical/x-ncbi-asn1-spec', '.aso': 'chemical/x-ncbi-asn1-binary', '.asx': 'video/x-ms-asf', '.atom': 'application/atom+xml', '.atomcat': 'application/atomcat+xml', '.atomsrv': 'application/atomserv+xml', '.au': 'audio/basic', '.avi': 'video/x-msvideo', '.awb': 'audio/amr-wb', '.axa': 'audio/annodex', '.axv': 'video/annodex', '.b': 'chemical/x-molconn-Z', '.bak': 'application/x-trash', '.bat': 'application/x-msdos-program', '.bcpio': 'application/x-bcpio', '.bib': 'text/x-bibtex', '.bin': 'application/octet-stream', '.bmp': 'image/x-ms-bmp', '.boo': 'text/x-boo', '.book': 'application/x-maker', '.brf': 'text/plain', '.bsd': 'chemical/x-crossfire', '.c': 'text/x-csrc', '.c++': 'text/x-c++src', '.c3d': 'chemical/x-chem3d', '.cab': 'application/x-cab', '.cac': 'chemical/x-cache', '.cache': 'chemical/x-cache', '.cap': 'application/vnd.tcpdump.pcap', '.cascii': 'chemical/x-cactvs-binary', '.cat': 'application/vnd.ms-pki.seccat', '.cbin': 'chemical/x-cactvs-binary', '.cbr': 'application/x-cbr', '.cbz': 'application/x-cbz', '.cc': 'text/x-c++src', '.cda': 'application/x-cdf', '.cdf': 'application/x-cdf', '.cdr': 'image/x-coreldraw', '.cdt': 'image/x-coreldrawtemplate', '.cdx': 'chemical/x-cdx', '.cdy': 'application/vnd.cinderella', '.cef': 'chemical/x-cxf', '.cer': 'chemical/x-cerius', '.chm': 'chemical/x-chemdraw', '.chrt': 'application/x-kchart', '.cif': 'chemical/x-cif', '.class': 'application/java-vm', '.cls': 'text/x-tex', '.cmdf': 'chemical/x-cmdf', '.cml': 'chemical/x-cml', '.cod': 'application/vnd.rim.cod', '.com': 'application/x-msdos-program', '.conf': 'text/plain', '.cpa': 'chemical/x-compass', '.cpio': 'application/x-cpio', '.cpp': 'text/x-c++src', '.cpt': 'image/x-corelphotopaint', '.cr2': 'image/x-canon-cr2', '.crl': 'application/x-pkcs7-crl', '.crt': 'application/x-x509-ca-cert', '.crw': 'image/x-canon-crw', '.csd': 'audio/csound', '.csf': 'chemical/x-cache-csf', '.csh': 'text/x-csh', '.csm': 'chemical/x-csml', '.csml': 'chemical/x-csml', '.css': 'text/css', '.csv': 'text/csv', '.ctab': 'chemical/x-cactvs-binary', '.ctx': 'chemical/x-ctx', '.cu': 'application/cu-seeme', '.cub': 'chemical/x-gaussian-cube', '.cxf': 'chemical/x-cxf', '.cxx': 'text/x-c++src', '.d': 'text/x-dsrc', '.davmount': 'application/davmount+xml', '.dcm': 'application/dicom', '.dcr': 'application/x-director', '.ddeb': 'application/vnd.debian.binary-package', '.deb': 'application/x-debian-package', '.deploy': 'application/octet-stream', '.dif': 'video/dv', '.diff': 'text/plain', '.dir': 'application/x-director', '.djv': 'image/vnd.djvu', '.djvu': 'image/vnd.djvu', '.dl': 'video/dl', '.dll': 'application/x-msdos-program', '.dmg': 'application/x-apple-diskimage', '.dms': 'application/x-dms', '.doc': 'application/msword', '.docm': 'application/vnd.ms-word.document.macroEnabled.12', '.docx': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', '.dot': 'application/msword', '.dotm': 'application/vnd.ms-word.template.macroEnabled.12', '.dotx': 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', '.dv': 'video/dv', '.dvi': 'application/x-dvi', '.dx': 'chemical/x-jcamp-dx', '.dxr': 'application/x-director', '.emb': 'chemical/x-embl-dl-nucleotide', '.embl': 'chemical/x-embl-dl-nucleotide', '.eml': 'message/rfc822', '.ent': 'chemical/x-pdb', '.eot': 'application/vnd.ms-fontobject', '.eps': 'application/postscript', '.eps2': 'application/postscript', '.eps3': 'application/postscript', '.epsf': 'application/postscript', '.epsi': 'application/postscript', '.epub': 'application/epub+zip', '.erf': 'image/x-epson-erf', '.es': 'application/ecmascript', '.etx': 'text/x-setext', '.exe': 'application/x-msdos-program', '.ez': 'application/andrew-inset', '.fb': 'application/x-maker', '.fbdoc': 'application/x-maker', '.fch': 'chemical/x-gaussian-checkpoint', '.fchk': 'chemical/x-gaussian-checkpoint', '.fig': 'application/x-xfig', '.flac': 'audio/x-flac', '.fli': 'video/fli', '.flv': 'video/x-flv', '.fm': 'application/x-maker', '.frame': 'application/x-maker', '.frm': 'application/x-maker', '.gal': 'chemical/x-gaussian-log', '.gam': 'chemical/x-gamess-input', '.gamin': 'chemical/x-gamess-input', '.gan': 'application/x-ganttproject', '.gau': 'chemical/x-gaussian-input', '.gcd': 'text/x-pcs-gcd', '.gcf': 'application/x-graphing-calculator', '.gcg': 'chemical/x-gcg8-sequence', '.gen': 'chemical/x-genbank', '.gf': 'application/x-tex-gf', '.gif': 'image/gif', '.gjc': 'chemical/x-gaussian-input', '.gjf': 'chemical/x-gaussian-input', '.gl': 'video/gl', '.gnumeric': 'application/x-gnumeric', '.gpt': 'chemical/x-mopac-graph', '.gsf': 'application/x-font', '.gsm': 'audio/x-gsm', '.gtar': 'application/x-gtar', '.gz': 'application/gzip', '.h': 'text/x-chdr', '.h++': 'text/x-c++hdr', '.hdf': 'application/x-hdf', '.hh': 'text/x-c++hdr', '.hin': 'chemical/x-hin', '.hpp': 'text/x-c++hdr', '.hqx': 'application/mac-binhex40', '.hs': 'text/x-haskell', '.hta': 'application/hta', '.htc': 'text/x-component', '.htm': 'text/html', '.html': 'text/html', '.hwp': 'application/x-hwp', '.hxx': 'text/x-c++hdr', '.ica': 'application/x-ica', '.ice': 'x-conference/x-cooltalk', '.ico': 'image/vnd.microsoft.icon', '.ics': 'text/calendar', '.icz': 'text/calendar', '.ief': 'image/ief', '.iges': 'model/iges', '.igs': 'model/iges', '.iii': 'application/x-iphone', '.info': 'application/x-info', '.inp': 'chemical/x-gamess-input', '.ins': 'application/x-internet-signup', '.iso': 'application/x-iso9660-image', '.isp': 'application/x-internet-signup', '.ist': 'chemical/x-isostar', '.istr': 'chemical/x-isostar', '.jad': 'text/vnd.sun.j2me.app-descriptor', '.jam': 'application/x-jam', '.jar': 'application/java-archive', '.java': 'text/plain', '.jdx': 'chemical/x-jcamp-dx', '.jmz': 'application/x-jmol', '.jng': 'image/x-jng', '.jnlp': 'application/x-java-jnlp-file', '.jp2': 'image/jp2', '.jpe': 'image/jpeg', '.jpeg': 'image/jpeg', '.jpf': 'image/jpx', '.jpg': 'image/jpeg', '.jpg2': 'image/jp2', '.jpm': 'image/jpm', '.jpx': 'image/jpx', '.js': 'application/javascript', '.json': 'application/json', '.kar': 'audio/midi', '.key': 'application/pgp-keys', '.kil': 'application/x-killustrator', '.kin': 'chemical/x-kinemage', '.kml': 'application/vnd.google-earth.kml+xml', '.kmz': 'application/vnd.google-earth.kmz', '.kpr': 'application/x-kpresenter', '.kpt': 'application/x-kpresenter', '.ksh': 'text/plain', '.ksp': 'application/x-kspread', '.kwd': 'application/x-kword', '.kwt': 'application/x-kword', '.latex': 'application/x-latex', '.lha': 'application/x-lha', '.lhs': 'text/x-literate-haskell', '.lin': 'application/bbolin', '.lsf': 'video/x-la-asf', '.lsx': 'video/x-la-asf', '.ltx': 'text/x-tex', '.ly': 'text/x-lilypond', '.lyx': 'application/x-lyx', '.lzh': 'application/x-lzh', '.lzx': 'application/x-lzx', '.m1v': 'video/mpeg', '.m3g': 'application/m3g', '.m3u': 'audio/x-mpegurl', '.m3u8': 'application/x-mpegURL', '.m4a': 'audio/mpeg', '.maker': 'application/x-maker', '.man': 'application/x-troff-man', '.manifest': 'application/x-ms-manifest', '.markdown': 'text/markdown', '.mbox': 'application/mbox', '.mcif': 'chemical/x-mmcif', '.mcm': 'chemical/x-macmolecule', '.md': 'text/markdown', '.mdb': 'application/msaccess', '.me': 'application/x-troff-me', '.mesh': 'model/mesh', '.mht': 'message/rfc822', '.mhtml': 'message/rfc822', '.mid': 'audio/midi', '.midi': 'audio/midi', '.mif': 'application/x-mif', '.mkv': 'video/x-matroska', '.mm': 'application/x-freemind', '.mmd': 'chemical/x-macromodel-input', '.mmf': 'application/vnd.smaf', '.mml': 'text/mathml', '.mmod': 'chemical/x-macromodel-input', '.mng': 'video/x-mng', '.moc': 'text/x-moc', '.mol': 'chemical/x-mdl-molfile', '.mol2': 'chemical/x-mol2', '.moo': 'chemical/x-mopac-out', '.mop': 'chemical/x-mopac-input', '.mopcrt': 'chemical/x-mopac-input', '.mov': 'video/quicktime', '.movie': 'video/x-sgi-movie', '.mp2': 'audio/mpeg', '.mp3': 'audio/mpeg', '.mp4': 'video/mp4', '.mpa': 'video/mpeg', '.mpc': 'chemical/x-mopac-input', '.mpe': 'video/mpeg', '.mpeg': 'video/mpeg', '.mpega': 'audio/mpeg', '.mpg': 'video/mpeg', '.mpga': 'audio/mpeg', '.mph': 'application/x-comsol', '.mpv': 'video/x-matroska', '.ms': 'application/x-troff-ms', '.msh': 'model/mesh', '.msi': 'application/x-msi', '.msp': 'application/octet-stream', '.msu': 'application/octet-stream', '.mvb': 'chemical/x-mopac-vib', '.mxf': 'application/mxf', '.mxu': 'video/vnd.mpegurl', '.nb': 'application/mathematica', '.nbp': 'application/mathematica', '.nc': 'application/x-netcdf', '.nef': 'image/x-nikon-nef', '.nwc': 'application/x-nwc', '.nws': 'message/rfc822', '.o': 'application/x-object', '.obj': 'application/octet-stream', '.oda': 'application/oda', '.odb': 'application/vnd.oasis.opendocument.database', '.odc': 'application/vnd.oasis.opendocument.chart', '.odf': 'application/vnd.oasis.opendocument.formula', '.odg': 'application/vnd.oasis.opendocument.graphics', '.odi': 'application/vnd.oasis.opendocument.image', '.odm': 'application/vnd.oasis.opendocument.text-master', '.odp': 'application/vnd.oasis.opendocument.presentation', '.ods': 'application/vnd.oasis.opendocument.spreadsheet', '.odt': 'application/vnd.oasis.opendocument.text', '.oga': 'audio/ogg', '.ogg': 'audio/ogg', '.ogv': 'video/ogg', '.ogx': 'application/ogg', '.old': 'application/x-trash', '.one': 'application/onenote', '.onepkg': 'application/onenote', '.onetmp': 'application/onenote', '.onetoc2': 'application/onenote', '.opf': 'application/oebps-package+xml', '.opus': 'audio/ogg', '.orc': 'audio/csound', '.orf': 'image/x-olympus-orf', '.otf': 'font/ttf', '.otg': 'application/vnd.oasis.opendocument.graphics-template', '.oth': 'application/vnd.oasis.opendocument.text-web', '.otp': 'application/vnd.oasis.opendocument.presentation-template', '.ots': 'application/vnd.oasis.opendocument.spreadsheet-template', '.ott': 'application/vnd.oasis.opendocument.text-template', '.oz': 'text/x-oz', '.oza': 'application/x-oz-application', '.p': 'text/x-pascal', '.p12': 'application/x-pkcs12', '.p7c': 'application/pkcs7-mime', '.p7r': 'application/x-pkcs7-certreqresp', '.pac': 'application/x-ns-proxy-autoconfig', '.pas': 'text/x-pascal', '.pat': 'image/x-coreldrawpattern', '.patch': 'text/plain', '.pbm': 'image/x-portable-bitmap', '.pcap': 'application/vnd.tcpdump.pcap', '.pcf': 'application/x-font-pcf', '.pcf.Z': 'application/x-font-pcf', '.pcx': 'image/pcx', '.pdb': 'chemical/x-pdb', '.pdf': 'application/pdf', '.pfa': 'application/x-font', '.pfb': 'application/x-font', '.pfr': 'application/font-tdpfr', '.pfx': 'application/x-pkcs12', '.pgm': 'image/x-portable-graymap', '.pgn': 'application/x-chess-pgn', '.pgp': 'application/pgp-encrypted', '.pk': 'application/x-tex-pk', '.pl': 'text/x-perl', '.pls': 'audio/x-scpls', '.pm': 'text/x-perl', '.png': 'image/png', '.pnm': 'image/x-portable-anymap', '.pot': 'text/plain', '.potm': 'application/vnd.ms-powerpoint.template.macroEnabled.12', '.potx': 'application/vnd.openxmlformats-officedocument.presentationml.template', '.ppa': 'application/vnd.ms-powerpoint', '.ppam': 'application/vnd.ms-powerpoint.addin.macroEnabled.12', '.ppm': 'image/x-portable-pixmap', '.pps': 'application/vnd.ms-powerpoint', '.ppsm': 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12', '.ppsx': 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', '.ppt': 'application/vnd.ms-powerpoint', '.pptm': 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', '.pptx': 'application/vnd.openxmlformats-officedocument.presentationml.presentation', '.prf': 'application/pics-rules', '.prt': 'chemical/x-ncbi-asn1-ascii', '.ps': 'application/postscript', '.psd': 'image/x-photoshop', '.pwz': 'application/vnd.ms-powerpoint', '.py': 'text/x-python', '.pyc': 'application/x-python-code', '.pyo': 'application/x-python-code', '.qgs': 'application/x-qgis', '.qt': 'video/quicktime', '.qtl': 'application/x-quicktimeplayer', '.ra': 'audio/x-realaudio', '.ram': 'audio/x-pn-realaudio', '.rar': 'application/rar', '.ras': 'image/x-cmu-raster', '.rb': 'application/x-ruby', '.rd': 'chemical/x-mdl-rdfile', '.rdf': 'application/rdf+xml', '.rdp': 'application/x-rdp', '.rgb': 'image/x-rgb', '.rm': 'audio/x-pn-realaudio', '.roff': 'application/x-troff', '.ros': 'chemical/x-rosdal', '.rpm': 'application/x-redhat-package-manager', '.rss': 'application/x-rss+xml', '.rtf': 'application/rtf', '.rtx': 'text/richtext', '.rxn': 'chemical/x-mdl-rxnfile', '.scala': 'text/x-scala', '.sce': 'application/x-scilab', '.sci': 'application/x-scilab', '.sco': 'audio/csound', '.scr': 'application/x-silverlight', '.sct': 'text/scriptlet', '.sd': 'chemical/x-mdl-sdfile', '.sd2': 'audio/x-sd2', '.sda': 'application/vnd.stardivision.draw', '.sdc': 'application/vnd.stardivision.calc', '.sdd': 'application/vnd.stardivision.impress', '.sdf': 'chemical/x-mdl-sdfile', '.sds': 'application/vnd.stardivision.chart', '.sdw': 'application/vnd.stardivision.writer', '.ser': 'application/java-serialized-object', '.sfd': 'application/vnd.font-fontforge-sfd', '.sfv': 'text/x-sfv', '.sgf': 'application/x-go-sgf', '.sgl': 'application/vnd.stardivision.writer-global', '.sgm': 'text/x-sgml', '.sgml': 'text/x-sgml', '.sh': 'text/x-sh', '.shar': 'application/x-shar', '.shp': 'application/x-qgis', '.shtml': 'text/html', '.shx': 'application/x-qgis', '.sid': 'audio/prs.sid', '.sig': 'application/pgp-signature', '.sik': 'application/x-trash', '.silo': 'model/mesh', '.sis': 'application/vnd.symbian.install', '.sisx': 'x-epoc/x-sisx-app', '.sit': 'application/x-stuffit', '.sitx': 'application/x-stuffit', '.skd': 'application/x-koan', '.skm': 'application/x-koan', '.skp': 'application/x-koan', '.skt': 'application/x-koan', '.sldm': 'application/vnd.ms-powerpoint.slide.macroEnabled.12', '.sldx': 'application/vnd.openxmlformats-officedocument.presentationml.slide', '.smi': 'application/smil+xml', '.smil': 'application/smil+xml', '.snd': 'audio/basic', '.so': 'application/octet-stream', '.spc': 'chemical/x-galactic-spc', '.spl': 'application/x-futuresplash', '.spx': 'audio/ogg', '.sql': 'application/x-sql', '.src': 'application/x-wais-source', '.srt': 'text/plain', '.stc': 'application/vnd.sun.xml.calc.template', '.std': 'application/vnd.sun.xml.draw.template', '.sti': 'application/vnd.sun.xml.impress.template', '.stl': 'application/sla', '.stw': 'application/vnd.sun.xml.writer.template', '.sty': 'text/x-tex', '.sv4cpio': 'application/x-sv4cpio', '.sv4crc': 'application/x-sv4crc', '.svg': 'image/svg+xml', '.svgz': 'image/svg+xml', '.sw': 'chemical/x-swissprot', '.swf': 'application/x-shockwave-flash', '.swfl': 'application/x-shockwave-flash', '.sxc': 'application/vnd.sun.xml.calc', '.sxd': 'application/vnd.sun.xml.draw', '.sxg': 'application/vnd.sun.xml.writer.global', '.sxi': 'application/vnd.sun.xml.impress', '.sxm': 'application/vnd.sun.xml.math', '.sxw': 'application/vnd.sun.xml.writer', '.t': 'application/x-troff', '.tar': 'application/x-tar', '.taz': 'application/x-gtar-compressed', '.tcl': 'text/x-tcl', '.tex': 'text/x-tex', '.texi': 'application/x-texinfo', '.texinfo': 'application/x-texinfo', '.text': 'text/plain', '.tgf': 'chemical/x-mdl-tgf', '.tgz': 'application/x-gtar-compressed', '.thmx': 'application/vnd.ms-officetheme', '.tif': 'image/tiff', '.tiff': 'image/tiff', '.tk': 'text/x-tcl', '.tm': 'text/texmacs', '.torrent': 'application/x-bittorrent', '.tr': 'application/x-troff', '.ts': 'video/MP2T', '.tsp': 'application/dsptype', '.tsv': 'text/tab-separated-values', '.ttc': 'font/collection', '.ttf': 'font/ttf', '.ttl': 'text/turtle', '.txt': 'text/plain', '.udeb': 'application/x-debian-package', '.uls': 'text/iuls', '.ustar': 'application/x-ustar', '.val': 'chemical/x-ncbi-asn1-binary', '.vcard': 'text/vcard', '.vcd': 'application/x-cdlink', '.vcf': 'text/vcard', '.vcs': 'text/x-vcalendar', '.vmd': 'chemical/x-vmd', '.vms': 'chemical/x-vamas-iso14976', '.vrm': 'x-world/x-vrml', '.vrml': 'x-world/x-vrml', '.vsd': 'application/vnd.visio', '.vss': 'application/vnd.visio', '.vst': 'application/vnd.visio', '.vsw': 'application/vnd.visio', '.wad': 'application/x-doom', '.wav': 'audio/x-wav', '.wax': 'audio/x-ms-wax', '.wbmp': 'image/vnd.wap.wbmp', '.wbxml': 'application/vnd.wap.wbxml', '.webm': 'video/webm', '.wiz': 'application/msword', '.wk': 'application/x-123', '.wm': 'video/x-ms-wm', '.wma': 'audio/x-ms-wma', '.wmd': 'application/x-ms-wmd', '.wml': 'text/vnd.wap.wml', '.wmlc': 'application/vnd.wap.wmlc', '.wmls': 'text/vnd.wap.wmlscript', '.wmlsc': 'application/vnd.wap.wmlscriptc', '.wmv': 'video/x-ms-wmv', '.wmx': 'video/x-ms-wmx', '.wmz': 'application/x-ms-wmz', '.woff': 'font/woff', '.woff2': 'font/woff2', '.wp5': 'application/vnd.wordperfect5.1', '.wpd': 'application/vnd.wordperfect', '.wrl': 'x-world/x-vrml', '.wsc': 'text/scriptlet', '.wsdl': 'application/xml', '.wvx': 'video/x-ms-wvx', '.wz': 'application/x-wingz', '.x3d': 'model/x3d+xml', '.x3db': 'model/x3d+binary', '.x3dv': 'model/x3d+vrml', '.xbm': 'image/x-xbitmap', '.xcf': 'application/x-xcf', '.xcos': 'application/x-scilab-xcos', '.xht': 'application/xhtml+xml', '.xhtml': 'application/xhtml+xml', '.xlam': 'application/vnd.ms-excel.addin.macroEnabled.12', '.xlb': 'application/vnd.ms-excel', '.xls': 'application/vnd.ms-excel', '.xlsb': 'application/vnd.ms-excel.sheet.binary.macroEnabled.12', '.xlsm': 'application/vnd.ms-excel.sheet.macroEnabled.12', '.xlsx': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', '.xlt': 'application/vnd.ms-excel', '.xltm': 'application/vnd.ms-excel.template.macroEnabled.12', '.xltx': 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', '.xml': 'application/xml', '.xpdl': 'application/xml', '.xpi': 'application/x-xpinstall', '.xpm': 'image/x-xpixmap', '.xsd': 'application/xml', '.xsl': 'application/xslt+xml', '.xslt': 'application/xslt+xml', '.xspf': 'application/xspf+xml', '.xtel': 'chemical/x-xtel', '.xul': 'application/vnd.mozilla.xul+xml', '.xwd': 'image/x-xwindowdump', '.xyz': 'chemical/x-xyz', '.xz': 'application/x-xz', '.zip': 'application/zip', '.zmt': 'chemical/x-mopac-input', '.~': 'application/x-trash'}¶
-
copyTo
(destination, followLinks=True)¶ Copies self to destination.
If self doesn’t exist, an OSError is raised.
If self is a directory, this method copies its children (but not itself) recursively to destination - if destination does not exist as a directory, this method creates it. If destination is a file, an IOError will be raised.
If self is a file, this method copies it to destination. If destination is a file, this method overwrites it. If destination is a directory, an IOError will be raised.
If self is a link (and followLinks is False), self will be copied over as a new symlink with the same target as returned by os.readlink. That means that if it is absolute, both the old and new symlink will link to the same thing. If it’s relative, then perhaps not (and it’s also possible that this relative link will be broken).
File/directory permissions and ownership will NOT be copied over.
If followLinks is True, symlinks are followed so that they’re treated as their targets. In other words, if self is a link, the link’s target will be copied. If destination is a link, self will be copied to the destination’s target (the actual destination will be destination’s target). Symlinks under self (if self is a directory) will be followed and its target’s children be copied recursively.
If followLinks is False, symlinks will be copied over as symlinks.
- @param destination: the destination (a FilePath) to which self
- should be copied
- @param followLinks: whether symlinks in self should be treated as links
- or as their targets
-
create
()¶ Exclusively create a file, only if this file previously did not exist.
@return: A file-like object opened from this path.
-
createDirectory
()¶ Create the directory the L{FilePath} refers to.
@see: L{makedirs}
@raise OSError: If the directory cannot be created.
-
createSimilarFile
(path)¶
-
delEntity
(name)¶
-
descendant
(segments)¶ Retrieve a child or child’s child of this path.
@param segments: A sequence of path segments as L{str} instances.
- @return: A L{FilePath} constructed by looking up the C{segments[0]}
- child of this path, the C{segments[1]} child of that path, and so on.
@since: 10.2
-
directoryListing
()¶ Return a resource that generates an HTML listing of the directory this path represents.
@return: A resource that renders the directory to HTML. @rtype: L{DirectoryLister}
-
dirname
()¶ Retrieve all of the components of the L{FilePath}’s path except the last one (everything up to the final path separator).
- @return: All of the components of the L{FilePath}’s path except the
- last one (everything up to the final path separator).
@rtype: the same type as this L{FilePath}’s C{path} attribute
-
entityType
= <InterfaceClass twisted.web.resource.IResource>¶
-
exists
()¶ Check if this L{FilePath} exists.
- @return: C{True} if the stats of C{path} can be retrieved successfully,
- C{False} in the other cases.
@rtype: L{bool}
-
forbidden
= <twisted.web.resource.ForbiddenResource object>¶
-
getAccessTime
()¶ Retrieve the time that this file was last accessed.
@return: a number of seconds from the epoch. @rtype: L{float}
-
getChild
(path, request)¶ If this L{File}”s path refers to a directory, return a L{File} referring to the file named C{path} in that directory.
If C{path} is the empty string, return a L{DirectoryLister} instead.
@param path: The current path segment. @type path: L{bytes}
@param request: The incoming request. @type request: An that provides L{twisted.web.iweb.IRequest}.
- @return: A resource representing the requested file or
- directory, or L{NoResource} if the path cannot be accessed.
@rtype: An object that provides L{resource.IResource}.
-
getChildForRequest
(request)¶
-
getChildWithDefault
(path, request)¶ Retrieve a static or dynamically generated child resource from me.
First checks if a resource was added manually by putChild, and then call getChild to check for dynamic resources. Only override if you want to affect behaviour of all child lookups, rather than just dynamic ones.
This will check to see if I have a pre-registered child resource of the given name, and call getChild if I do not.
@see: L{IResource.getChildWithDefault}
-
getContent
()¶ Retrieve the contents of the file at this path.
@return: the contents of the file @rtype: L{bytes}
-
getDevice
()¶ Retrieves the device containing the file. The inode number and device number together uniquely identify the file, but the device number is not necessarily consistent across reboots or system crashes.
- @raise NotImplementedError: if the platform is Windows, since the
- device number would be 0 for all partitions on a Windows platform
@return: a number representing the device @rtype: L{int}
@since: 11.0
-
getDynamicEntity
(name, request)¶
-
getFileSize
()¶ Return file size.
-
getGroupID
()¶ Returns the group ID of the file.
- @raise NotImplementedError: if the platform is Windows, since the GID
- is always 0 on windows
@return: the group ID of the file @rtype: L{int} @since: 11.0
-
getInodeNumber
()¶ Retrieve the file serial number, also called inode number, which distinguishes this file from all other files on the same device.
- @raise NotImplementedError: if the platform is Windows, since the
- inode number would be a dummy value for all files in Windows
@return: a number representing the file serial number @rtype: L{int} @since: 11.0
-
getModificationTime
()¶ Retrieve the time of last access from this file.
@return: a number of seconds from the epoch. @rtype: L{float}
-
getNumberOfHardLinks
()¶ Retrieves the number of hard links to the file.
This count keeps track of how many directories have entries for this file. If the count is ever decremented to zero then the file itself is discarded as soon as no process still holds it open. Symbolic links are not counted in the total.
- @raise NotImplementedError: if the platform is Windows, since Windows
- doesn’t maintain a link count for directories, and L{os.stat} does not set C{st_nlink} on Windows anyway.
@return: the number of hard links to the file @rtype: L{int} @since: 11.0
-
getPermissions
()¶ Returns the permissions of the file. Should also work on Windows, however, those permissions may not be what is expected in Windows.
@return: the permissions for the file @rtype: L{Permissions} @since: 11.1
-
getStaticEntity
(name)¶
-
getStatusChangeTime
()¶ Retrieve the time of the last status change for this file.
@return: a number of seconds from the epoch. @rtype: L{float}
-
getUserID
()¶ Returns the user ID of the file’s owner.
- @raise NotImplementedError: if the platform is Windows, since the UID
- is always 0 on Windows
@return: the user ID of the file’s owner @rtype: L{int} @since: 11.0
-
getatime
()¶ Deprecated. Use getAccessTime instead.
-
getctime
()¶ Deprecated. Use getStatusChangeTime instead.
-
getmtime
()¶ Deprecated. Use getModificationTime instead.
-
getsize
()¶ Retrieve the size of this file in bytes.
@return: The size of the file at this file path in bytes. @raise Exception: if the size cannot be obtained. @rtype: L{int}
-
globChildren
(pattern)¶ Assuming I am representing a directory, return a list of FilePaths representing my children that match the given pattern.
@param pattern: A glob pattern to use to match child paths. @type pattern: L{unicode} or L{bytes}
@return: A L{list} of matching children. @rtype: L{list} of L{FilePath}, with the mode of C{pattern}’s type
-
ignoreExt
(ext)¶ Ignore the given extension.
Serve file.ext if file is requested
-
indexNames
= ['index', 'index.html', 'index.htm', 'index.rpy']¶
-
isBlockDevice
()¶ Returns whether the underlying path is a block device.
@return: C{True} if it is a block device, C{False} otherwise @rtype: L{bool} @since: 11.1
-
isLeaf
= 0¶
-
isSocket
()¶ Returns whether the underlying path is a socket.
@return: C{True} if it is a socket, C{False} otherwise @rtype: L{bool} @since: 11.1
-
isabs
()¶ Check if this L{FilePath} refers to an absolute path.
This always returns C{True}.
@return: C{True}, always. @rtype: L{bool}
-
isdir
()¶ Check if this L{FilePath} refers to a directory.
- @return: C{True} if this L{FilePath} refers to a directory, C{False}
- otherwise.
@rtype: L{bool}
-
isfile
()¶ Check if this file path refers to a regular file.
- @return: C{True} if this L{FilePath} points to a regular file (not a
- directory, socket, named pipe, etc), C{False} otherwise.
@rtype: L{bool}
-
islink
()¶ Check if this L{FilePath} points to a symbolic link.
- @return: C{True} if this L{FilePath} points to a symbolic link,
- C{False} otherwise.
@rtype: L{bool}
-
linkTo
(linkFilePath)¶ Creates a symlink to self to at the path in the L{FilePath} C{linkFilePath}.
Only works on posix systems due to its dependence on L{os.symlink}. Propagates L{OSError}s up from L{os.symlink} if C{linkFilePath.parent()} does not exist, or C{linkFilePath} already exists.
@param linkFilePath: a FilePath representing the link to be created. @type linkFilePath: L{FilePath}
-
listDynamicEntities
(request=None)¶
-
listDynamicNames
()¶
-
listEntities
()¶
-
listNames
()¶
-
listStaticEntities
()¶
-
listStaticNames
()¶
-
listdir
()¶ List the base names of the direct children of this L{FilePath}.
- @return: A L{list} of L{bytes}/L{unicode} giving the names of the
- contents of the directory this L{FilePath} refers to. These names are relative to this L{FilePath}.
@rtype: L{list}
- @raise: Anything the platform L{os.listdir} implementation might raise
- (typically L{OSError}).
-
makeProducer
(request, fileForReading)¶ Make a L{StaticProducer} that will produce the body of this response.
This method will also set the response code and Content-* headers.
@param request: The L{twisted.web.http.Request} object. @param fileForReading: The file object containing the resource. @return: A L{StaticProducer}. Calling C{.start()} on this will begin
producing the response.
-
makedirs
(ignoreExistingDirectory=False)¶ Create all directories not yet existing in C{path} segments, using L{os.makedirs}.
- @param ignoreExistingDirectory: Don’t raise L{OSError} if directory
- already exists.
@type ignoreExistingDirectory: L{bool}
@return: L{None}
-
moveTo
(destination, followLinks=True)¶ Move self to destination - basically renaming self to whatever destination is named.
If destination is an already-existing directory, moves all children to destination if destination is empty. If destination is a non-empty directory, or destination is a file, an OSError will be raised.
If moving between filesystems, self needs to be copied, and everything that applies to copyTo applies to moveTo.
- @param destination: the destination (a FilePath) to which self
- should be copied
- @param followLinks: whether symlinks in self should be treated as links
- or as their targets (only applicable when moving between filesystems)
-
open
(mode='r')¶ Open this file using C{mode} or for writing if C{alwaysCreate} is C{True}.
In all cases the file is opened in binary mode, so it is not necessary to include C{“b”} in C{mode}.
@param mode: The mode to open the file in. Default is C{“r”}. @type mode: L{str} @raises AssertionError: If C{“a”} is included in the mode and
C{alwaysCreate} is C{True}.@rtype: L{file} @return: An open L{file} object.
-
openForReading
()¶ Open a file and return it.
-
parent
()¶ A file path for the directory containing the file at this file path.
- @return: A L{FilePath} representing the path which directly contains
- this L{FilePath}.
@rtype: L{FilePath}
-
parents
()¶ Retrieve an iterator of all the ancestors of this path.
@return: an iterator of all the ancestors of this path, from the most recent (its immediate parent) to the root of its filesystem.
-
path
= None¶
-
preauthChild
(path)¶ Use me if C{path} might have slashes in it, but you know they’re safe.
- @param path: A relative path (ie, a path not starting with C{“/”})
- which will be interpreted as a child or descendant of this path.
@type path: L{bytes} or L{unicode}
@return: The child path. @rtype: L{FilePath} with a mode equal to the type of C{path}.
-
processors
= {}¶
-
putChild
(path, child)¶ Register a static child.
You almost certainly don’t want ‘/’ in your path. If you intended to have the root of a folder, e.g. /foo/, you want path to be ‘’.
@see: L{IResource.putChild}
-
reallyPutEntity
(name, entity)¶
-
realpath
()¶ Returns the absolute target as a L{FilePath} if self is a link, self otherwise.
The absolute link is the ultimate file or directory the link refers to (for instance, if the link refers to another link, and another…). If the filesystem does not support symlinks, or if the link is cyclical, raises a L{LinkError}.
Behaves like L{os.path.realpath} in that it does not resolve link names in the middle (ex. /x/y/z, y is a link to w - realpath on z will return /x/y/z, not /x/w/z).
@return: L{FilePath} of the target path. @rtype: L{FilePath} @raises LinkError: if links are not supported or links are cyclical.
-
redirect
(request)¶
-
remove
()¶ Removes the file or directory that is represented by self. If C{self.path} is a directory, recursively remove all its children before removing the directory. If it’s a file or link, just delete it.
-
render_GET
(request)¶ Begin sending the contents of this L{File} (or a subset of the contents, based on the ‘range’ header) to the given request.
-
render_HEAD
(request)¶ Begin sending the contents of this L{File} (or a subset of the contents, based on the ‘range’ header) to the given request.
-
requireCreate
(val=1)¶ Sets the C{alwaysCreate} variable.
- @param val: C{True} or C{False}, indicating whether opening this path
- will be required to create the file or not.
@type val: L{bool}
@return: L{None}
-
restat
(reraise=True)¶ Re-calculate cached effects of ‘stat’. To refresh information on this path after you know the filesystem may have changed, call this method.
- @param reraise: a boolean. If true, re-raise exceptions from
- L{os.stat}; otherwise, mark this path as not existing, and remove any cached stat information.
- @raise Exception: If C{reraise} is C{True} and an exception occurs
- while reloading metadata.
-
segmentsFrom
(ancestor)¶ Return a list of segments between a child and its ancestor.
For example, in the case of a path X representing /a/b/c/d and a path Y representing /a/b, C{Y.segmentsFrom(X)} will return C{[‘c’, ‘d’]}.
@param ancestor: an instance of the same class as self, ostensibly an ancestor of self.
@raise: ValueError if the ‘ancestor’ parameter is not actually an ancestor, i.e. a path for /x/y/z is passed as an ancestor for /a/b/c/d.
@return: a list of strs
-
sep
¶ Return a filesystem separator.
@return: The native filesystem separator. @returntype: The same type as C{self.path}.
-
server
= None¶
-
setContent
(content, ext=b'.new')¶ Replace the file at this path with a new file that contains the given bytes, trying to avoid data-loss in the meanwhile.
On UNIX-like platforms, this method does its best to ensure that by the time this method returns, either the old contents I{or} the new contents of the file will be present at this path for subsequent readers regardless of premature device removal, program crash, or power loss, making the following assumptions:
- your filesystem is journaled (i.e. your filesystem will not I{itself} lose data due to power loss)
- your filesystem’s C{rename()} is atomic
- your filesystem will not discard new data while preserving new metadata (see U{http://mjg59.livejournal.com/108257.html} for more detail)
On most versions of Windows there is no atomic C{rename()} (see U{http://bit.ly/win32-overwrite} for more information), so this method is slightly less helpful. There is a small window where the file at this path may be deleted before the new file is moved to replace it: however, the new file will be fully written and flushed beforehand so in the unlikely event that there is a crash at that point, it should be possible for the user to manually recover the new version of their data. In the future, Twisted will support atomic file moves on those versions of Windows which I{do} support them: see U{Twisted ticket 3004<http://twistedmatrix.com/trac/ticket/3004>}.
This method should be safe for use by multiple concurrent processes, but note that it is not easy to predict which process’s contents will ultimately end up on disk if they invoke this method at close to the same time.
@param content: The desired contents of the file at this path. @type content: L{bytes}
- @param ext: An extension to append to the temporary filename used to
- store the bytes while they are being written. This can be used to make sure that temporary files can be identified by their suffix, for cleanup in case of crashes.
@type ext: L{bytes}
-
sibling
(path)¶ Return a L{FilePath} with the same directory as this instance but with a basename of C{path}.
@param path: The basename of the L{FilePath} to return. @type path: L{str}
@return: The sibling path. @rtype: L{FilePath}
-
siblingExtension
(ext)¶ Attempt to return a path with my name, given the extension at C{ext}.
@param ext: File-extension to search for. @type ext: L{bytes} or L{unicode}
@return: The sibling path. @rtype: L{FilePath} with the same mode as the type of C{ext}.
-
siblingExtensionSearch
(*exts)¶ Attempt to return a path with my name, given multiple possible extensions.
Each extension in C{exts} will be tested and the first path which exists will be returned. If no path exists, L{None} will be returned. If C{‘’} is in C{exts}, then if the file referred to by this path exists, C{self} will be returned.
The extension ‘*’ has a magic meaning, which means “any path that begins with C{self.path + ‘.’} is acceptable”.
-
splitext
()¶ Split the file path into a pair C{(root, ext)} such that C{root + ext == path}.
- @return: Tuple where the first item is the filename and second item is
- the file extension. See Python docs for L{os.path.splitext}.
@rtype: L{tuple}
-
statinfo
¶ FilePath.statinfo is deprecated.
@param value: value to set statinfo to, if setting a value @return: C{_statinfo} if getting, L{None} if setting
Deprecated in Twisted 15.0.0; please use other FilePath methods such as getsize(), isdir(), getModificationTime(), etc. instead.
-
temporarySibling
(extension=b'')¶ Construct a path referring to a sibling of this path.
The resulting path will be unpredictable, so that other subprocesses should neither accidentally attempt to refer to the same path before it is created, nor they should other processes be able to guess its name in advance.
- @param extension: A suffix to append to the created filename. (Note
- that if you want an extension with a ‘.’ you must include the ‘.’ yourself.)
@type extension: L{bytes} or L{unicode}
- @return: a path object with the given extension suffix, C{alwaysCreate}
- set to True.
@rtype: L{FilePath} with a mode equal to the type of C{extension}
-
touch
()¶ Updates the access and last modification times of the file at this file path to the current time. Also creates the file if it does not already exist.
- @raise Exception: if unable to create or modify the last modification
- time of the file.
-
type
= None¶
-
walk
(descend=None)¶ Yield myself, then each of my children, and each of those children’s children in turn.
The optional argument C{descend} is a predicate that takes a FilePath, and determines whether or not that FilePath is traversed/descended into. It will be called with each path for which C{isdir} returns C{True}. If C{descend} is not specified, all directories will be traversed (including symbolic links which refer to directories).
- @param descend: A one-argument callable that will return True for
- FilePaths that should be traversed, False otherwise.
@return: a generator yielding FilePath-like objects.
-
-
class
BufferFileTransfer
(file, size, request)[source]¶ Bases:
object
A class to represent the transfer of a file over the network.
-
request
= None¶
-
-
class
_tz
[source]¶ Bases:
datetime.tzinfo
-
utcoffset
(dt)[source]¶ datetime -> timedelta showing offset from UTC, negative values indicating West of UTC
-
fromutc
()¶ datetime in UTC -> datetime in local time.
-
-
class
_CET
[source]¶ Bases:
coherence.upnp.core.utils._tz
-
_offset
= datetime.timedelta(seconds=3600)¶
-
_name
= 'CET'¶
-
dst
(dt)¶ datetime -> DST offset as timedelta positive east of UTC.
-
fromutc
()¶ datetime in UTC -> datetime in local time.
-
tzname
(dt)¶ datetime -> string name of time zone.
-
utcoffset
(dt)¶ datetime -> timedelta showing offset from UTC, negative values indicating West of UTC
-
-
class
_CEST
[source]¶ Bases:
coherence.upnp.core.utils._tz
-
_offset
= datetime.timedelta(seconds=7200)¶
-
_name
= 'CEST'¶
-
dst
(dt)¶ datetime -> DST offset as timedelta positive east of UTC.
-
fromutc
()¶ datetime in UTC -> datetime in local time.
-
tzname
(dt)¶ datetime -> string name of time zone.
-
utcoffset
(dt)¶ datetime -> timedelta showing offset from UTC, negative values indicating West of UTC
-
coherence.upnp.core.variable (module)¶
-
class
StateVariable
(upnp_service, name, implementation, instance, send_events, data_type, allowed_values)[source]¶ Bases:
coherence.log.LogAble
-
logCategory
= 'variable'¶
-
COLOR_FORMAT
= '[%(levelname)-18s][\x1b[1m%(name)-15s\x1b[0m] %(message)s (\x1b[1m%(filename)s\x1b[0m:%(lineno)d)'¶
-
FORMAT
= '[%(levelname)-18s][$BOLD%(name)-15s$RESET] %(message)s ($BOLD%(filename)s$RESET:%(lineno)d)'¶
-
_Loggable__logger
= None¶
-
critical
(message, *args, **kwargs)¶
-
debug
(message, *args, **kwargs)¶
-
error
(message, *args, **kwargs)¶
-
exception
(message, *args, **kwargs)¶
-
fatal
(message, *args, **kwargs)¶
-
info
(message, *args, **kwargs)¶
-
log
(message, *args, **kwargs)¶
-
msg
(message, *args, **kwargs)¶
-
warn
(message, *args, **kwargs)¶
-
warning
(message, *args, **kwargs)¶
-