mirror of
https://github.com/creyD/creyPY.git
synced 2026-04-14 12:20:31 +02:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f8b781b3e7 | ||
|
|
93c7f6f6cb |
@@ -1,13 +1,13 @@
|
|||||||
import json
|
import json
|
||||||
from httpx import AsyncClient, ASGITransport
|
from httpx import ASGITransport, AsyncClient
|
||||||
|
|
||||||
|
|
||||||
class AsyncGenericClient:
|
class AsyncGenericClient:
|
||||||
def __init__(self, app):
|
def __init__(self, app, headers={}):
|
||||||
self.c = AsyncClient(
|
self.c = AsyncClient(
|
||||||
transport=ASGITransport(app=app), base_url="http://testserver", follow_redirects=True
|
transport=ASGITransport(app=app), base_url="http://testserver", follow_redirects=True
|
||||||
)
|
)
|
||||||
self.default_headers = {}
|
self.default_headers = headers
|
||||||
|
|
||||||
async def get(self, url: str, r_code: int = 200, parse_json=True):
|
async def get(self, url: str, r_code: int = 200, parse_json=True):
|
||||||
re = await self.c.get(url, headers=self.default_headers)
|
re = await self.c.get(url, headers=self.default_headers)
|
||||||
|
|||||||
Reference in New Issue
Block a user