Git Product home page Git Product logo

monstr's Introduction

monstr

python code for working with nostr

  • A basic relay implementation for testing against locally
  • Client for working with a single relay
  • ClientPool for working with multiple relays
  • Keys for working with and converting between hex/npub/nsec

install

$ git clone https://github.com/monty888/monstr.git  
$ cd monstr  
$ python3 -m venv venv  
$ source venv/bin/activate  
$ pip install -r requirements.txt  
$ -- probably required to run examples else nostr module won't be found  
$ export PYTHONPATH="$PYTHONPATH:./"

Note: developed against python 3.8

use

basic queries with context manager

    from monstr.client.client import Client

    async with Client(url) as c:
        events = await c.query({
            'limit': 100
        })

        for c_evt in events:
            print(c_evt)

basic queries without context manager

    from monstr.client.client import Client

    c = Client(url)
    asyncio.create_task(c.run())
    await c.wait_connect()
    events = await c.query({
        'limit': 100
    })

    for c_evt in events:
        print(c_evt)
    c.end()

for more see /monstr/examples

TODO

Eventually try to work how the ... python packages work, for now just copy in the folder and install the requirements. The examples folder is not required.

monstr's People

Contributors

monty888 avatar pj8912 avatar xavierfiechter avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.