semvec/pypi-packages huggingface dataset:
rabbitmq-subprocess-client 1.0.1
rabbitmq-subprocess-client is a RabbitMQ client (based on `pika`) spawning tasks as subprocess, allowing handling segfault gracefully.
License: MIT
Requires Python: >=3.8,<4.0

RabbitMQ-subprocess-client
=====================

RabbitMQ-subprocess-client is a RabbitMq client (based on `pika`) spawning tasks as subprocess, allowing handling segfault gracefully. 


# Install
```bash
pip install rabbitmq-subprocess-client
```

# usage
```python
import os
from concurrent.futures import TimeoutError
import traceback
from rabbitmq_subprocess_client import Runner, Consumer

class MyConsumer(Consumer):
    def consume_main(self, basic_deliver, msg):
        print(f'pre-processing message: {msg} in process: {os.getpid()}')
        try:
            args = []
            kwargs = {}
            self.exec(msg, *args, **kwargs)  # This will run the consume_subprocess method in a subprocess
            self.acknowledge_message(basic_deliver.delivery_tag)
        except TimeoutError:
            self.nacknowledge_message(basic_deliver.delivery_tag)
        except BaseException:
            exc_msg = traceback.format_exc()
            print(exc_msg)
            self.nacknowledge_message(basic_deliver.delivery_tag)

    @staticmethod
    def consume_subprocess(msg, *args, **kwargs):
        print(f'processing message: {msg} in process: {os.getpid()}')

worker = Runner(
    'my_queue', 
    MyConsumer, 
    host="127.0.0.1",
    port="5672",
    user="guest",
    password="guest",
    timeout=None,
)
worker.run()
```

    
# develop
```bash
poetry shell
poetry install
pytest
pre-commit install
```

# Publish new version
```bash
poetry publish --build --username= --password=
```
hko 0.3.2
An unofficial Python wrapper for public API of Hong Kong Observatory
License: MIT
Requires Python: >=3.7,<4.0
Keywords: hko,weather

[![GitHub Release][releases-shield]][releases]
[![PyPI][pypi-releases-shield]][pypi-releases]

# python-hko
A python warpper for retrieving Hong Kong SAR local weather from Hong Kong Observatory Open Data API.
Please refer to the Official Documentation for request parameters and response details.
[Official API Documentation][hko-documentation]

## Reference
### HKO Module
`hko.HKO(session)`
Manage and perform requests
Return: hko.HKO class

Parameter | Optional (default value) | Type | Description
--- | --- | --- | ---
session | no | ClientSession | see [aiohttp](https://docs.aiohttp.org/en/stable/client_reference.html)

`hko.HKO.weather(dataType, lang)`
Retrieve weather data from Weather Information API
Return: dictionary

Parameter | Optional (default value) | Type | Description
--- | --- | --- | ---
dataType | no | string | type of data requested
lang | yes (en) | string | language used in response

`hko.HKO.earthquake(dataType, lang)`
Retrieve weather data from Earthquake Information API
Return: dictionary

Parameter | Optional (default value) | Type | Description
--- | --- | --- | ---
dataType | no | string | type of data requested
lang | yes (en) | string | language used in response

`hko.HKO.openData(dataType, lang)`
Retrieve weather data from Earthquake Information API
Return: dictionary

Parameter | Optional (default value) | Type | Description
--- | --- | --- | ---
dataType | no | string | type of data requested
lang | yes (en) | string | language used in response
station | - | string | refer to [Official API Documentation][hko-documentation]
year | - | string | refer to [Official API Documentation][hko-documentation]
month | - | string |refer to [Official API Documentation][hko-documentation]
day | - | string | refer to [Official API Documentation][hko-documentation]
hour | - | string | refer to [Official API Documentation][hko-documentation]


## Usage Example
Get and print local weather forcast general situation in English
```python
from hko import HKO, HKOError
import asyncio
from aiohttp import ClientSession
from aiohttp import ClientConnectorError

async def main():
    async with ClientSession() as session:
        try:
            hko = HKO(session)
            fnd = await hko.weather(dataType="fnd")
            print(fnd["generalSituation"])
        except HKOError as error:
            print(error)

asyncio.run(main())
```





[hko-documentation]: https://www.hko.gov.hk/en/weatherAPI/doc/files/HKO_Open_Data_API_Documentation.pdf
[releases]: https://github.com/MisterCommand/python-hko
[releases-shield]: https://img.shields.io/github/release/MisterCommand/python-hko.svg?style=popout
[pypi-releases]: https://pypi.org/project/hko/
[pypi-releases-shield]: https://img.shields.io/pypi/v/hko