hanguangbaihuo / sparrow_cloud Goto Github PK
View Code? Open in Web Editor NEW基于k8s的微服务框架
License: MIT License
基于k8s的微服务框架
License: MIT License
sparrow_cloud/sparrow_cloud/message_service/sender.py
Lines 86 to 114 in 389fe22
运行下列函数报错,即带有参数args便会报错:
send_task_v3("test7", "hello for py",name="waro")
报错信息如下:
TypeError: send_task() got multiple values for argument 'exchange'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "", line 1, in
File "/Users/wr/python3_venv/venv3_manage/lib/python3.7/site-packages/sparrow_cloud/message_service/sender.py", line 114, in send_task_v3
error_message, message_code, args, kwargs))
Exception: 消息发送失败,失败原因send_task() got multiple values for argument 'exchange', 消息内容message_code=test7,消息参数('hello for py',){'name': 'waro'}
虽然返回403错误无疑是正确的,但是却影藏了之所以没有权限的原因细节,给前端排查原因造成了不便。现在B端因为token失效经常会反403错误
在sparrow_cloud/registry/service_registry文件中
fix #74 需要更新负载均衡算法.....
例如:则下方示例中的put方法中的不能被注册到文档中
class SomeView(generics.RetrieveDestroyAPIView):
'''
获取单个视图
get:
# 获取单个应用的负责人
url: /api/backend_app/apps_owner/1/
方法:get
参数:需要认证
返回:
{
"id": 1,
"app_name": "SparrowTest",
"app_id": 150,
"user_id": "xxxxxxxxxxxxf",
"phone": "18888888,
"name": "waro163"
}
'''
serializer_class = AppsOwnerSerializer
queryset = AppOwner.objects.all()
permission_classes = (IsAuthenticated,)
def put(self, request, *args, **kwargs):
'''
### 更新单个视图
url: /api/backend_app/apps_owner/1/
方法:put
参数:需要认证
{
"phone":"186666666"
}
返回:
{
"id": 1,
"app_name": "SparrowTest",
"app_id": 150,
"user_id": "oooooooooooooooo",
"phone": "1866666666",
"name": "somebody"
}
'''
pass
sparrow_cloud/restclient/rest_client.py
第28行,requests.request, args 和 kwargs 参数没有带上 timeout
现在的用法是:task_id=send_task(exchange=SYNC_PRODUCT_STOCK_WITH_XX['EXCHANGE'],
routing_key=SYNC_PRODUCT_STOCK_WITH_XX['ROUTING_KEY'],
message_code=SYNC_PRODUCT_STOCK_WITH_XX['MESSAGE_CODE']
)
可以考虑将exchange,routing_key,message_code合并成一个_conf参数,简化调用时参数传递
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.