#28916 closed defect (worksforme)

Stem's launch_tor_with_config() does not support ordered (onion service) options

Reported by: teor Owned by: atagar
Priority: Medium Milestone:
Component: Archived/Stem Version:
Severity: Normal Keywords:
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:


Unlike stem.control.set_options(), stem.process.launch_tor_with_config() requires a dictionary.

Python's dict.items() is in an arbitrary order, so stem.process.launch_tor_with_config() can't be used to set onion service options.

Child Tickets

Change History (3)

comment:1 Changed 22 months ago by atagar

Status: newneeds_information

Hi teor, try providing an OrderedDict instead...

import collections
import stem.process

  config = collections.OrderedDict([
    ('ControlPort', '2778'),
    ('Log', 'NOTICE stdout'),
    ... etc...

Did you have any other questions?

comment:2 Changed 22 months ago by teor

Having one interface that accepts an array, and another that requires an OrderedDict is confusing.
Can you please update the documentation to explain which type is used for ordered arguments in each interface?

comment:3 Changed 22 months ago by atagar

Resolution: worksforme
Status: needs_informationclosed

Hi teor. Sorry, I don't understand what you mean. launch_tor_with_config() only takes a dictionary, not an array. Maybe you mean the array input argument to the OrderedDict? If so then that's how ordered dictionaries are made. Nothing stem specific.

I'm not spotting anything to be done here on my side. I agree that the need for an OrderedDict is a bit confusing, but that confusion is because tor has a single, unique set of hidden service arguments that are order dependent. Given that requirement Stem handles this the proper pythonic way.

Note: See TracTickets for help on using tickets.