semvec/pypi-packages huggingface dataset:
reqMock 0.0.0.5
Mock requests in python3
Requires Python: >=3.6

# reqMock
Mock requests library like HTTPToolkit in python3

# Installation
```bash
pip install reqMock
```

# Example:
## Original code
```python3
import requests
print(requests.get("https://google.com").text)
```

## Import in first line of code
```python3
from reqMock import mockControl as mock
```

## Enable mock
```python3
# To enable mock
mock.set(enable = True)

# To disable mock
mock.set(enable = False)
```

## Mock `https://google.com` to another website
```python3
mock.add(
	url = "https://google.com",	# mock 'from'
	method = "GET",			# method 'from'
	mockCheck = "url",			# method mock ('host', 'url', 'match')
	mockMethod = "url",			# mock to 'url' or 'text'
	to = "https://youtube.com",	# data
	# headers = None, 			# change header of this request
	# data = None, 				# change data of this request
	# status_code = 200 		# change status code of this request
)
```

## Mock `https://youtube.com` to custom result
```python3
mock.add(
	url = "https://youtube.com",
	method = "GET",	
	mockCheck = "url",	
	mockMethod = "text",
	to = "Hello World!",
	# headers = None, 
	# data = None, 
	# status_code = 200
)
```

## Enable `showQuery` to print info from requests
```python3
mock.set(showQuery = True)		# Default is False

# You will see output requests like this 
# ">> requests: GET: https://google.com (headers={'abc': 'def'})" and below is result output
```

## Enable `showResult` to print result output from requests
```python3
mock.set(showResult = True)		# Default is False

# You will see output requests like this 
# ">> result: GET: https://google.com" and below is result output
```

## Enable `showTrace` to print call stack trace
```python3
mock.set(showTrace = True)		# Default is False

# You will see detailed call stack trace like this:
# >> trace:
#    1. <module> of <main> at line 10 -> main()
#    2. main() of <main> at line 5 -> result = func_a()
#    3. func_a(
#           param1='test_value',
#           param2='custom_value'
#       ) of <main> at line 2 -> return func_b()
#    4. func_b(
#           arg1='test_value',
#           arg2='custom_value'
#       ) of <main> at line 3 -> return requests.get("https://httpbin.org/get")
#    5. requests.get(url='https://httpbin.org/get', params={'key': 'value'})
```

## Redirect output of `show` to file
```python3
mock.set(stdout = open('out.txt', 'w'))

# Output of 'show' option will write to file instead of write to output
```

# If you want to rename this module for hide from check
```python3
# Open a python3 shell
from reqMock import mockControl as mock

# Example change module name from 'reqMock' to 'Khanh'
mock.set(moduleName = "Khanh")
# Choose 'y' and new name will applied in new session

# For new session, import it by using new name
from Khanh import mockControl as mock
```
windmill-project 0.0.1
A tiny library that offers support for event handling and messaging streams between multiple consumers.
Requires Python: >=3.10

<div style="display: inline-flex; align-items: center;">
    <img src="windmill.png" width="128", height="128">
    <div style="margin: 0 0 0 30px;">
        <h1>Windmill</h1>
        <h2>Handling events on Python in a soft way</h2>
    </div>
</div>

---
## What is Windmill?
This project is a Python library that offers a more soft and minimalist way to handle events in your Python application. The main idea of Windmill is to provide a decoupled way to communicate a lot of parts of your code about events without creating any direct links or dependencies between isolated regions of code.

---
## The Features
This project currently supports the following features:
- Async event publishing
- Sync and async handlers (listeners)
- Priority level for events
- "once" execution for events
- Simple listeners subscription API and decorators

---
## How to install
You can install the library through `pip install` command:
```bash
pip install windmill
```

---
## How to use
Here is a little example of how to use this library in your project:
```python
# Here we import the library
from windmill.event_bus import EventBus,  Event

# It creates an instance of EventBus
bus = EventBus()

# Here we define an event listener
# We are saying that when the 'greet' event is emitted, then executes something. This listener receives the emitted event instance as parameter.
@bus.on('greet')
def hello(event: Event):
    print(f"Hello world, {event.payload}!")

# Here we publish the 'greet' event with the 'Bob' as payload (data)
bus.publish('greet', 'Bob')
```
The expected output for the code above is:
```
Hello world, Bob!
```

---
## Todos:
- [ ] Wildcard topics
- [ ] Retry/Backoff and DLQ
- [ ] Write unit tests
- [ ] Roles and permissions
- [ ] Payload validation
- [ ] Data persistence (json, db, etc.)
- [ ] Metrics and tracing system