[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [stem/master] Descriptor.from_str() method



commit 670f403bb3f5df82cf7d16d938e4b37ddfd09917
Merge: e810cc09 2192228e
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Tue Nov 20 13:38:13 2018 -0800

    Descriptor.from_str() method
    
    As requested by irl [1] adding a from_str() method to our Descriptor class,
    similar to ControlMessage's from_str() [2].
    
    This method makes it much simpler to parse descriptors from byte strings.
    Unlike parse_file() this defaults to providing a single descriptor, with a
    'multiple = True' flag that should be provided if your content has more than
    one...
    
      my_server_descriptor = RelayServerDescriptor.from_str(content)
    
      consensus_relays = NetworkStatusDocumentV3.from_str(consensus_content, multiple = True)
    
    [1] https://trac.torproject.org/projects/tor/ticket/28450
    [2] https://stem.torproject.org/api/response.html#stem.response.ControlMessage.from_str

 docs/change_log.rst                |  3 ++-
 stem/descriptor/__init__.py        | 55 ++++++++++++++++++++++++++++++++++++--
 test/settings.cfg                  |  1 +
 test/unit/descriptor/descriptor.py | 51 +++++++++++++++++++++++++++++++++++
 4 files changed, 107 insertions(+), 3 deletions(-)

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits