Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
thriftpy2-httpx-client
Advanced tools
This package is provides an alternative HTTP client for ThriftPy2 which
uses HTTPX instead of the builtin http.client
and http.server
libraries. This allows the developer to use more complex features like
authentication, fine grained timeouts, and asyncio.
Setup (Borrowed from ThriftPy2 Docs):
.. code-block:: thrift
# pingpong.thrift
service PingPong {
string ping(),
}
.. code-block:: python
import thriftpy2
from thriftpy2.http import make_server
pingpong_thrift = thriftpy2.load(
"pingpong.thrift",
module_name="pingpong_thrift",
)
class Dispatcher(object):
def ping(self):
return "pong"
server = make_server(
service=pingpong_thrift.PingPong,
handler=Dispatcher(),
host='127.0.0.1',
port=6000,
)
server.serve()
Async Usage:
.. code-block:: python
from thriftpy2_httpx_client import make_aio_client
client = await make_aio_client(pingpong_thrift, url='http://localhost:6000')
print(await client.ping()) # prints 'pong'
Sync Usage:
.. code-block:: python
from thriftpy2_httpx_client import make_sync_client
client = make_sync_client(pingpong_thrift, url='http://localhost:6000')
print(client.ping()) # prints 'pong'
Additional keyword arguments can be passed to the client to configure
the internal httpx.AsyncClient()
and httpx.Client()
instances. For
example, you can enable Kerberos authentication using httpx-gssapi
:
.. code-block:: python
from httpx_gssapi import HTTPSPNEGOAuth
from thriftpy2_httpx_client import make_aio_client
client = await make_aio_client(
pingpong_thrift,
url='http://localhost:6000',
auth=HTTPSPNEGOAuth(),
)
print(await client.ping()) # prints 'pong'
FAQs
HTTPX Client for ThriftPy2
We found that thriftpy2-httpx-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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.