it got stuck a few lines later at

line 17, in main

events = await client.get_events_of([f], timedelta(seconds=15))

^^^^^^^^^^^^^^^^^^^^

AttributeError: 'Client' object has no attribute 'get_events_of'

https://github.com/ev3rst/nostr_sdk_examples/blob/main/ns_read_metadata.py

Reply to this note

Please Login to reply.

Discussion

What I do in these situations where there has been an API change, is I start poking around.

Open up a python repl and start playing around. You can type `client` and press tab (depending on your python install, and it will show all functions available.

```

from nostr_sdk import Metadata, Client, NostrSigner, Keys, Filter, PublicKey, Kind

client = Client()

```

# press tab

client.TAB

```

>>> client.

client.add_discovery_relay( client.fetch_events_from( client.send_event_builder( client.subscribe_with_id_to(

client.add_read_relay( client.fetch_metadata( client.send_event_builder_to( client.subscription(

client.add_relay( client.filtering() client.send_event_to( client.subscriptions()

client.add_relay_with_opts( client.force_remove_all_relays() client.send_msg_to( client.sync(

client.add_write_relay( client.force_remove_relay( client.send_private_msg( client.try_connect(

client.automatic_authentication( client.gift_wrap( client.send_private_msg_to( client.unsubscribe(

client.connect() client.gift_wrap_to( client.set_metadata( client.unsubscribe_all()

client.connect_relay( client.handle_notifications( client.shutdown() client.unwrap_gift_wrap(

client.database() client.relay( client.sign_event_builder( client.update_min_pow_difficulty(

client.disconnect() client.relays() client.signer() client.wait_for_connection(

client.disconnect_relay( client.remove_all_relays() client.subscribe(

client.fetch_combined_events( client.remove_relay( client.subscribe_to(

client.fetch_events( client.send_event( client.subscribe_with_id(

```

OR if that doesnt work you can do dir()

```

dir(client)

>>> dir(client)

['__annotations__', '__class__', '__del__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getstate__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_make_instance_', '_pointer', '_uniffi_clone_pointer', 'add_discovery_relay', 'add_read_relay', 'add_relay', 'add_relay_with_opts', 'add_write_relay', 'automatic_authentication', 'connect', 'connect_relay', 'database', 'disconnect', 'disconnect_relay', 'fetch_combined_events', 'fetch_events', 'fetch_events_from', 'fetch_metadata', 'filtering', 'force_remove_all_relays', 'force_remove_relay', 'gift_wrap', 'gift_wrap_to', 'handle_notifications', 'relay', 'relays', 'remove_all_relays', 'remove_relay', 'send_event', 'send_event_builder', 'send_event_builder_to', 'send_event_to', 'send_msg_to', 'send_private_msg', 'send_private_msg_to', 'set_metadata', 'shutdown', 'sign_event_builder', 'signer', 'subscribe', 'subscribe_to', 'subscribe_with_id', 'subscribe_with_id_to', 'subscription', 'subscriptions', 'sync', 'try_connect', 'unsubscribe', 'unsubscribe_all', 'unwrap_gift_wrap', 'update_min_pow_difficulty', 'wait_for_connection']

```

Either way you can see that `get_events_of` has most likely been renamed to: `fetch_events_from`

More playing:

```

>>> client.fetch_events_from()

Traceback (most recent call last):

File "", line 1, in

TypeError: Client.fetch_events_from() missing 3 required positional arguments: 'urls', 'filter', and 'timeout'

```

It seems like those are the things you are passing in your code, so seems to be the one? Go play around! 😉