Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
pyopenuv
is a simple Python library for retrieving UV-related information from
openuv.io.
pip install pyopenuv
pyopenuv
is currently supported on:
You can get an API key from the OpenUV console.
import asyncio
from pyopenuv import Client
from pyopenuv.errors import OpenUvError
async def main():
client = Client(
"<OPENUV_API_KEY>", "<LATITUDE>", "<LONGITUDE>", altitude="<ALTITUDE>"
)
try:
# Get the current status of the OpenUV API:
print(await client.api_status())
# >>> True
# Get current UV info:
print(await client.uv_index())
# >>> { "result": { ... } }
# Get forecasted UV info:
print(await client.uv_forecast())
# >>> { "result": { ... } }
# Get UV protection window:
print(await client.uv_protection_window())
# >>> { "result": { ... } }
# Get API usage info/statistics:
print(await client.api_statistics())
# >>> { "result": { ... } }
except OpenUvError as err:
print(f"There was an error: {err}")
asyncio.run(main())
If you would prefer to not call api_status
manually, you can configure the Client
object
to automatically check the status of the OpenUV API before executing any of the API
methods—simply pass the check_status_before_request
parameter:
import asyncio
from pyopenuv import Client
from pyopenuv.errors import ApiUnavailableError, OpenUvError
async def main():
client = Client(
"<OPENUV_API_KEY>",
"<LATITUDE>",
"<LONGITUDE>",
altitude="<ALTITUDE>",
check_status_before_request=True,
)
try:
print(await client.uv_index())
except ApiUnavailableError:
print("The API is unavailable")
except OpenUvError as err:
print(f"There was an error: {err}")
asyncio.run(main())
By default, the library creates a new connection to OpenUV with each coroutine. If you
are calling a large number of coroutines (or merely want to squeeze out every second of
runtime savings possible), an aiohttp
ClientSession
can be used for
connection pooling:
import asyncio
from aiohttp import ClientSession
from pyopenuv import Client
from pyopenuv.errors import OpenUvError
async def main():
async with ClientSession() as session:
client = Client(
"<OPENUV_API_KEY>",
"<LATITUDE>",
"<LONGITUDE>",
altitude="<ALTITUDE>",
session=session,
)
try:
print(await client.uv_index())
except OpenUvError as err:
print(f"There was an error: {err}")
asyncio.run(main())
Thanks to all of our contributors so far!
python3 -m venv .venv
source ./.venv/bin/activate
script/setup
poetry run pytest --cov pyopenuv tests
README.md
with any new documentation.FAQs
A simple Python API data from openuv.io
We found that pyopenuv demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.