fix api client
This commit is contained in:
parent
3cf7eb21ec
commit
2518bf0e84
@ -164,7 +164,7 @@ class WebAPIClient:
|
||||
timeout=self.timeout,
|
||||
**kwargs)
|
||||
|
||||
if r.headers['content-type'] != 'application/json':
|
||||
if not r.headers['content-type'].startswith('application/json'):
|
||||
raise ApiResponseError(r.status_code, 'TypeError', 'content-type is not application/json')
|
||||
|
||||
data = json.loads(r.text)
|
||||
|
@ -1,7 +1,15 @@
|
||||
#!/usr/bin/env python3
|
||||
from home.api import WebAPIClient
|
||||
from home.api.types import BotType
|
||||
from home.config import config
|
||||
import sys
|
||||
import os.path
|
||||
sys.path.extend([
|
||||
os.path.realpath(
|
||||
os.path.join(os.path.dirname(os.path.join(__file__)), '..')
|
||||
)
|
||||
])
|
||||
|
||||
from src.home.api import WebAPIClient
|
||||
from src.home.api.types import BotType
|
||||
from src.home.config import config
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
x
Reference in New Issue
Block a user