HTTP/2 Support
Soteri’s Scanning Service supports HTTP/2. To take advantage, use a HTTP/2 compatible client.
curl
curl 7.47.0 and greater enables HTTP/2 by default. You can pass --http2-prior-knowledge
to skip the HTTP/1.1 negotiation up to HTTP/2:
curl --http2-prior-knowledge -F file=@"file.txt" https://api.soteri.io/rest/scan
python
HTTPX is a python library which provides support for HTTP/2 requests. (requests does not currently provide this support). First, install optional HTTP/2 requirements in your environment:
pip install httpx[http2]
Then, you can make requests like so:
import asyncio
import httpx
from pprint import pprint
async def request():
params = {
'includeAllowlisted': 'true',
}
files = [
('file', ('file-1.txt', open('file-1.txt', 'rb'))),
('file', ('file-2.txt', open('file-2.txt', 'rb'))),
]
async with httpx.AsyncClient(http2=True) as client:
response = await client.post("https://api.soteri.io/rest/scan", params=params, files=files)
response.raise_for_status()
return response.json()
response = asyncio.run(request())
pprint(response)