Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
httprest
is a minimalistic framework for communicating with REST APIs.
Its goal is to reduce a boilerplate code required to communicate with APIs.
http
package exposing an HTTP client interface. There is also a client implementation that uses urllib
under the hood. So no need to use extra libraries like requests
api.API
class which may be overridden and used to make API callsfrom httprest import API
class MyAPI(API):
def operation(self):
result = self._request("POST", "/operation/endpoint", json={...})
if result.ok:
print(result.json)
api = MyAPI("http://api.com")
api.operation()
pip install httprest
The library exposes an HTTPClient
interface and provides two implementations for it:
http.urllib_client.UrllibHTTPClient
: the default implementation, uses the urllib
library under the hoodhttp.requests_client.RequestsHTTPClient
: uses the requests
library under the hoodfrom httprest.http import HTTPClient, HTTPResponse
class MyHTTPClient(HTTPClient):
def _request(...) -> HTTPResponse
And then you simply use it in the API client:
api = MyAPI(..., http_client=MyHTTPClient())
The library provides the http.fake_client
module containing FakeHTTPClient
class.
That class may be used for API testing. Example:
from httprest.http.fake_client import FakeHTTPClient, HTTPResponse
http_client = FakeHTTPClient(responses=[HTTPResponse(200, b"", headers={})])
api = MyAPI(..., http_client=http_client)
api.operation()
# assert your expectations here
assert http_client.history == [...]
FAQs
A library for making simple REST-like HTTP requests
We found that httprest 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
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.