Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to Query Relays for Specific Event Id #81

Open
steveboi123 opened this issue Feb 25, 2023 · 1 comment
Open

How to Query Relays for Specific Event Id #81

steveboi123 opened this issue Feb 25, 2023 · 1 comment

Comments

@steveboi123
Copy link

If I have an event id, and I want to get the entire event data, how can I query the relays to get it?

@f321x
Copy link

f321x commented Mar 10, 2023

I think you can write a filter like this to fetch the specific event id you have:

filters = Filters([Filter(event_ids=["YOUREVENTIDSTRING"])])

Once you receive your requested event with code like this for example:

while relay_manager.message_pool.has_events():
  event_msg = relay_manager.message_pool.get_event()
  print(event_msg.event.PARAMETER)  # for example event_msg.content

You can get the event data with the following parameters:
event_msg.id
event_msg.pubkey
event_msg.created_at
event_msg.kind
event_msg.tags
event_msg.content
event_msg.sig

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants