Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Using @decorator
to easily request an HTTP Client
This framework based on aiohttp's http client framework.
Use Annotated Type to describe the elements required in an HTTP request.
Python 3.10 or higher is required.
pip install ahttp-client
An example is the API provided by the BUS API.
import asyncio
import aiohttp
from ahttp_client import request, Session, Query
from typing import Annotated, Any
loop = asyncio.get_event_loop()
class MetroAPI(Session):
def __init__(self, loop: asyncio.AbstractEventLoop):
super().__init__("https://api.yhs.kr", loop=loop)
@request("GET", "/metro/station")
async def station_search_with_query(
self,
response: aiohttp.ClientResponse,
name: Annotated[str, Query]
) -> dict[str, Any]:
return await response.json()
async def main():
async with MetroAPI(loop) as client:
data = await client.station_search_with_query(name="metro-station-name")
print(len(data))
loop.run_until_complete(main())
FAQs
A framework for easy asynchronous HTTP request calling with decorations
We found that ahttp-client 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
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.