我正在使用curl
JSON发送到API端点.然而,在bash链中的某个地方,它变得混乱了.
有关编码的特殊信息curl
吗?
如果我像这样构造有效载荷:
PAYLOAD='payload={"channel": "github", "username": "webhookbot", "icon_emoji": ":ghost:", "text": "'
PAYLOAD+=$1
PAYLOAD+=' " }'
echo $PAYLOAD
curl -X POST --data-urlencode "$PAYLOAD" $SLACKPOSTURL
echo "sent"
Run Code Online (Sandbox Code Playgroud)
我会收到一个错误
Payload无效JSONsent
但是,如果我只是硬连线为输出分配一个变量
PAYLOAD='payload={"channel": "github", "username": "webhookbot", "icon_emoji": ":ghost:", "text": "LAST_COMMIT Merge pull request #558 from dcsan/boteditor Boteditor " }'
Run Code Online (Sandbox Code Playgroud)
那么它会很好.
是否存在一些简单的赋值与串联字符串不同的东西?在控制台中,输出看起来相同.
FWIW有些消息可以通过,但内容如下:
LAST_COMMIT来自dcsan/boteditor Boteditor的合并拉取请求#558
只有经过硬编码才能通过.所以它不是另一个非洲人看到的,它与消息的构建方式有关.
(抱歉,大图像不确定如何在此降价派生中调整大小)
我在网页中有一些视频,使用 html5 视频标签。在 android 上,视频将在页面上保持内联,允许我在它周围有其他内容,例如 HTML 中的字幕。
但是在 iPhone 上,当你点击播放时,视频会全屏跳出,破坏任何其他功能。
有没有办法阻止这种接管?
在 Android 或普通网络上,我们没有这个问题。
仅供参考的标签使用是(玉)
video(width="100%" controls="controls" autoplay="true" id='videoPlayer' class='video-player')
source(src="#{videoUrl}" type="video/mp4")
Run Code Online (Sandbox Code Playgroud)
plotly 库有一些不错的桑基图 https://plotly.com/python/sankey-diagram/
但数据要求您传递源/目标对的索引。
link = dict(
source = [0, 1, 0, 2, 3, 3], # indices correspond to labels, eg A1, A2, A1, B1, ...
target = [2, 3, 3, 4, 4, 5],
Run Code Online (Sandbox Code Playgroud)
我想知道是否有一个 API 可以简单地传递这些对的命名列表?
links = [
{'source': 'start', 'target': 'A', 'value': 2},
{'source': 'A', 'target': 'B', 'value': 2},
...
]
Run Code Online (Sandbox Code Playgroud)
这更符合bokeh/holoviews期望数据的方式 (但 sankey 不适用于自循环)
还有这个pysankey 小部件
这样我就可以更接近地映射到我的数据框而不处理所有内容?
或者,有没有一种很好的 Pythonic 方法可以将其转换为单行:D
我有许多导入其他非类型化库的文件。
我已将此添加到mypy.ini
例如:
[coloredlogs]
ignore_missing_imports = True
Run Code Online (Sandbox Code Playgroud)
那么也许这可以不检查库本身?例如,在 a/venv
但仍在 every.single.place 中导入了一个库,我收到这些警告。
我可以让忽略工作的唯一方法是在 every.single.import 上添加注释
import coloredlogs # type: ignore
参考文献:https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
我想将ES6作为输出.这是一个节点服务器端应用程序,我可以在最前沿的iojs发行版上运行,希望支持最新的es6语法.
但我不清楚如何使用新的导入语法使用标准NPM库?
require
现在是一个坏词.我注意到这个答案,但
import http from "http";
import request from "request";
Run Code Online (Sandbox Code Playgroud)
给
error TS2307: Cannot find module 'http'
Run Code Online (Sandbox Code Playgroud)
有没有一种方法可以使用这些标准节点库或其他NPM模块,而无需复杂的转换/ babel构建链?
我试图在运行时在 prisma 中定义一个查询,但陷入了第一个障碍。
所以这有效:
const items = await prisma.styleTags.findMany({
orderBy: {
name: 'asc',
}
});
Run Code Online (Sandbox Code Playgroud)
但是当我尝试单独定义查询时,我收到 TS 错误。
const orderBy = {
cname: 'asc',
}
const items2 = await prisma.styleTags.findMany({
orderBy
});
Run Code Online (Sandbox Code Playgroud)
这两件事应该是相同的吗?但在自动生成代码的 prisma 迷宫深处的某个地方......
Type '{ cname: string; priority: string; }' is not assignable to type 'Enumerable<StyleTagsOrderByWithRelationInput> | undefined'.
Type '{ cname: string; priority: string; }' is not assignable to type 'StyleTagsOrderByWithRelationInput'.
Types of property 'cname' are incompatible.
Type 'string' is not assignable to type 'SortOrder | …
Run Code Online (Sandbox Code Playgroud) 我在让 VueRouter 导航时遇到问题。在我的应用程序中,一些页面工作正常,并且使用相同的代码,其他页面路由不起作用/页面不更新导航。
路由器有问题吗?就像你不能从组件内部调用路由器一样,或者......?
我的应用程序中的命名路线
export default new VueRouter({
routes: [
{
path: '/grams/one/:cname',
component: GramsOne,
name: "gramsOne"
},
...
Run Code Online (Sandbox Code Playgroud)
然后在页面上的组件内:
<q-btn v-for='(rel, key) in gram.relatedItems' :key='key'
color='secondary'
@click="goGram(rel)"
>
{{rel.cn}}
</q-btn>
// later in the script:
methods: {
goGram(gram) {
let newRoute = {
name: 'gramsOne',
params: {cname: gram.cname}
}
console.log('goGram', newRoute)
this.$router.push(newRoute)
}
},
Run Code Online (Sandbox Code Playgroud)
在同一页面的其他地方,简单的路由工作。URL 地址将在浏览器中更新。我看到带有路由信息的正确控制台日志
但页面/内容不会改变。
更新 URL 栏后,我可以按 ctrl-R 并加载新页面。所以目标路线工作正常。
从同一个应用程序中的其他页面,我可以使用相同的路线来定位新目的地并正常加载。
这也加载了相同的 URL,只是导致问题的查询参数不同。
/app/items/foo /app/items/bar
哪里bar
是某种属性的类型/app/items/:foo
我尝试了命名路由、路由使用等的各种组合,但看不到模式。
"vue": "~2.5.0",
"vue-resource": "^1.3.4",
"vue-router": "^2.7.0" …
Run Code Online (Sandbox Code Playgroud) 使用谷歌新的可视化 DialogFlow CX 构建器,我将参数传递给 Flow。模拟器显示参数已设置,我可以访问它,$session.params.anger
但想知道如何设置会话/页面/意图参数。
还有这些条件块的语法是什么。似乎有一些奇怪的类似 bash 的语法。它似乎if/else/endif
有效并且具有基本的语法突出显示,但我只是通过反复试验发现了这一点。有没有这方面的文件?也许它是 ES 的一个共同特征?
https://cloud.google.com/dialogflow/cx/docs/concept/parameter
python ×2
typescript ×2
bash ×1
curl ×1
dataframe ×1
ecmascript-6 ×1
embed ×1
html5-video ×1
iphone ×1
json ×1
mypy ×1
npm ×1
orm ×1
plotly ×1
prisma ×1
shell ×1
type-hinting ×1
vue-router ×1
vue.js ×1
vuejs2 ×1