In rust-nostr, from `v0.34`, is available an embedded tor client. Here is a python example (just call `embedded_tor` on client `Options`): https://github.com/rust-nostr/nostr/blob/c4270c075a12ad0bc4a268ef5074089a4b421cee/bindings/nostr-sdk-ffi/bindings-python/examples/tor.py