GithubHelp home page GithubHelp logo

trendingtechnology / hoist Goto Github PK

View Code? Open in Web Editor NEW

This project forked from 2231puppy/hoist

0.0 2.0 0.0 55 KB

Communicate with other python files via the local network.

Home Page: https://pypi.org/project/hoist3

License: MIT License

Python 100.00%

hoist's Introduction

PyPI PyPI - Status PyPI - Downloads GitHub GitHub last commit https://discord.gg/W9QwbpbUbJ

Documentation coming in version 0.1.4

Features

  • Easy to use with object oriented syntax.
  • Intellisense support with typehints and docstrings.
  • High flexibility with configuration options.
  • Supports newer versions of Python.
  • Self explanatory error messages.

Upcoming features

  • Enhanced docstrings
  • Documentation
  • Proxys
  • CLI

Installation

To install hoist, run one of these commands, depending on your OS.

Linux/Mac

python3 -m pip install -U hoist3

Windows

py -3 -m pip install -U hoist3

Credits

This project was developed by ZeroIntensity, under the MIT License.

Dependencies

Examples

Basic Server Example

# file1.py

import hoist

client = hoist.Client()

server = client.create_server('localhost', 5000)

@server.received('hi')
def receive(message):
    return 'Hello!'

@server.received()
def catch_all(message):
    print(f'{message} was received.')
# file2.py

import hoist

client = hoist.Client()
server = client.find_server('localhost', 5000)

resp = server.send('hi')
server.send('test') # Prints out "test was received" in file1

print(resp) # Prints out "Hello!"

Basic API Example

# file1.py
import hoist

client = hoist.Client()
server = client.create_server('localhost', 6000)

schema: dict = {
    'hello': 'hi',
    'hi': 'hello',
    'message', 'response'
}

server.add_auto_return(schema)

@server.received()
def not_found(message):
    return hoist.Error('not found', 404)
# file2.py
import hoist

client = hoist.Client()
server = client.find_server('localhost', 6000)

resp = server.send('hi')
print(resp) # prints out "hello"

resp_2 = server.send('a') # raises "hoist.ServerResponseError"

hoist's People

Contributors

zerointensity avatar

Watchers

 avatar  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.