问题标签 [hug]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
154 浏览

python-3.x - 使用 Python 图像库 (PIL) 保存 gif 图像时动画 GIF 图像像素化

我正在尝试在Hug / python 中创建一个图像上传实用程序,并希望保存图像和 gif。但是在上传一些 gif 图像时,gif 图像似乎有很多像素化。下面给出的是我在上传实用程序中使用的代码片段。

0 投票
0 回答
59 浏览

python - 如何将 JSON 字符串分配给 POST 请求中的变量,以便在函数中使用?

我正在 python 中使用 hug 编写一个 API,我无法将 JSON 字符串传递给我的函数使用的变量,然后它将被添加到数据库中。我正在使用 RestClient Firefox 插件来发送 POST 请求。

这是我的功能的样子:

我的内容类型是:'Content-Type: application/json'. 这是我在 RestClient 主体中的样子:

截至目前使用此代码,我收到此错误:json.decoder.JSONDecodeError: Invalid control character at: line 1 column 16 (char 15)

谢谢。

0 投票
0 回答
32 浏览

python - Hug API:在 @hug.object.urls 中使用前缀时,GET 端点不起作用

我在 Python 3.8.0 中使用了 hug 2.6.1,当我在 hug.object.urls 中使用前缀时,我遇到了 GET 端点问题。例如,此代码不起作用(/test/myendpoint 返回 404 http 状态错误):

我在做坏事?或者这是一个问题?