在 py3 里同步/异步混合使用 httpx 调用

Est at 
比如开发需求是请求一个 http API,得到数据,解析一下返回,那么一般的做法是封装一个方法,比如 import httpxdef get_sth(p1, default=MY_VAL): # network r = httpx.get(API_URL, params={'t1': p1}) # parsing res = r.json().get('my_key') or MY_VAL 但是如果想在 async/await 里用这段代码,就得改成 import httpxasync def get_sth(p1, default=MY_VAL): # netw……