小编Gio*_*que的帖子

Django - 缺少 1 个必需的位置参数:“请求”

我收到错误

get_indiceComercioVarejista() 缺少 1 个必需的位置参数:“请求”

尝试访问方法 get_indiceComercioVarejista 时。我不知道它有什么问题。

意见:

from django.http import JsonResponse
from django.shortcuts import render, HttpResponse
import requests
import pandas as pd

from rest_framework.views import APIView
from rest_framework.response import Response

class ChartData(APIView):

    authentication_classes = []
    permission_classes = []

    def get(self, request, format=None):

         data = {
            'customer' : 10,
            'sales': 100
        }

        return Response(data)

    def get_indiceComercioVarejista(self, request, format=None):
        data = {
            'customer' : 10,
            'sales': 100
        }
        return Response(data)
Run Code Online (Sandbox Code Playgroud)

网址:

from django.conf.urls import url
from . import views
from …
Run Code Online (Sandbox Code Playgroud)

python django web django-rest-framework

7
推荐指数
1
解决办法
3万
查看次数

如何从 Kafka 有线格式的 avro 事件中解码 schema id?

希望你们一切顺利。

我正在从 Kafka 主题获取数据,其中每种类型都有多个事件类型和模式。由于 Kafka 使用有线格式,第一个字节是魔术字节,从字节 1 到 4 我们有 schema-id,在第 5 个字节之后我们有数据本身。

我想解码 schema-id,以便能够从 schema-registry 获取 schema。我怎样才能用Python做到这一点?

例如,如果我有b'\x00\x00\x00\x04'schema-id 二进制文件,如何解码该二进制文件以便获得 schema-id 的实际值?

python avro apache-kafka

3
推荐指数
1
解决办法
1200
查看次数

标签 统计

python ×2

apache-kafka ×1

avro ×1

django ×1

django-rest-framework ×1

web ×1