Skip to content

Python 3.11 and are the examples up to date? #87

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

Open
brianoflondon opened this issue Mar 4, 2023 · 2 comments
Open

Python 3.11 and are the examples up to date? #87

brianoflondon opened this issue Mar 4, 2023 · 2 comments

Comments

@brianoflondon
Copy link

I'd love to use this but I'm already working in Python 3.11. I can't even import the library properly.

BTW I added it to my project with poetry add git+https://github.com/jeffthibault/python-nostr.git instead of PyPi.

First error trying to use the connect to relays example is this:

ValueError: mutable default <class 'nostr.relay.RelayPolicy'> for field policy is not allowed: use default_factory

A quick look at the code and I can't understand how this:

relay_manager.open_connections(
    {"cert_reqs": ssl.CERT_NONE}
)  # NOTE: This disables ssl certificate verification

Will work as I can't see a open_connections method on that class, is the doc out of date?

I would like to provide NIP-57 support to the people all using my non-custodial NIP-05 system but I really don't have the capacity to dig into this library and fix it at this time.

I tried to install for Dev but had a bunch of problems which I can expand on if it helps anyone, suffice to say I can't get a dev environment working properly.

@ghost
Copy link

ghost commented Mar 18, 2023

i had some issues too, but i couldn't get it to work so i moved to a fork of this library which is located here

Everything works, sadly no docs yet so you'll need to look through the code for answers.
If you need help, feel free to mention me

@Jxck-S
Copy link

Jxck-S commented Jul 26, 2023

ry

Docs are def out of date. open_connnections and close are both deprecated. Connecting is auto-done when adding a relay.

For ValueError: mutable default <class 'nostr.relay.RelayPolicy'> for field policy is not allowed: use default_factory
Same problem mentioned here #82 (comment)

This is the fix
In relay.py add field to the dataclasses import from dataclasses import dataclass, field

Also change line 37 to use the default factory field
policy: RelayPolicy = field(default_factory=RelayPolicy)

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