aiocoap.numbers.optionnumbers module

Known values for CoAP option numbers

The values defined in OptionNumber correspond to the IANA registry “CoRE Parameters”, subregistries “CoAP Method Codes” and “CoAP Response Codes”.

The option numbers come with methods that can be used to evaluate their properties, see the OptionNumber class for details.

class aiocoap.numbers.optionnumbers.OptionNumber

Bases: aiocoap.util.ExtensibleIntEnum

A CoAP option number.

As the option number contains information on whether the option is critical, and whether it is safe-to-forward, those properties can be queried using the is_* group of methods.

Note that whether an option may be repeated or not does not only depend on the option, but also on the context, and is thus handled in the Options object instead.

IF_MATCH = <OptionNumber 1 "IF_MATCH">
URI_HOST = <OptionNumber 3 "URI_HOST">
ETAG = <OptionNumber 4 "ETAG">
IF_NONE_MATCH = <OptionNumber 5 "IF_NONE_MATCH">
OBSERVE = <OptionNumber 6 "OBSERVE">
URI_PORT = <OptionNumber 7 "URI_PORT">
LOCATION_PATH = <OptionNumber 8 "LOCATION_PATH">
URI_PATH = <OptionNumber 11 "URI_PATH">
CONTENT_FORMAT = <OptionNumber 12 "CONTENT_FORMAT">
MAX_AGE = <OptionNumber 14 "MAX_AGE">
URI_QUERY = <OptionNumber 15 "URI_QUERY">
ACCEPT = <OptionNumber 17 "ACCEPT">
LOCATION_QUERY = <OptionNumber 20 "LOCATION_QUERY">
BLOCK2 = <OptionNumber 23 "BLOCK2">
BLOCK1 = <OptionNumber 27 "BLOCK1">
SIZE2 = <OptionNumber 28 "SIZE2">
PROXY_URI = <OptionNumber 35 "PROXY_URI">
PROXY_SCHEME = <OptionNumber 39 "PROXY_SCHEME">
SIZE1 = <OptionNumber 60 "SIZE1">
NO_RESPONSE = <OptionNumber 258 "NO_RESPONSE">
OBJECT_SECURITY = <OptionNumber 21 "OBJECT_SECURITY">
is_critical()
is_elective()
is_unsafe()
is_safetoforward()
is_nocachekey()
is_cachekey()
format
create_option(decode=None, value=None)

Return an Option element of the appropriate class from this option number.

An initial value may be set using the decode or value options, and will be fed to the resulting object’s decode method or value property, respectively.