curl

Send unserialized & unescaped HTML file data to an API with a bash script

孤人 提交于 2021-01-29 06:08:04
问题 I wanted to create a bash script that takes an HTML file and sends it to several APIs. I have a test.html file with unserialized HTML data like this: <h2 id="overview">Overview</h2> <p>Have the source of truth in your own space at <strong>somewhere</strong></p> <pre> <code class="lang-javascript">function go() { console.log('code blocks can be a pain'); } go(); </code> </pre> I need to send the content of the file somehow to an API, like this: curl --location --request POST 'https://devo.to

How to pass a variable that contains a file to a curl POST payload?

主宰稳场 提交于 2021-01-29 06:05:07
问题 I am trying to make a CURL command to hit an elasticsearch endpoint and what I have to do is essentially read a script from a file (a multi-lined file) and then pass that script into the json payload for a POST request. I don't know ho to pass it in correctly to the payload. I have tried ${script}, "'"${script}"'". Not sure how to proceed next My script: int editScore(def x) { x + 1; } ctx.new_post_score = editScore(ctx.post_score); ctx.new_grade = ctx.new_post_score; My bash script: location

Unable to find resource error from Curl response

送分小仙女□ 提交于 2021-01-29 06:01:41
问题 I am using a curl command to retrieve data like so - curl http://url/devices/views/all/device.json This works a treat however gives me a large amount of mostly useless data. The documentation here states that I can add field specifications to reduces the fields that are returned from the call so I tried - curl -d 'json={"fields=['kismet_device_base_name']"}' http://url/devices/views/all/device.json where the fields variable allows you to specifically chose which fields you want returned in

How to update a issue or PR comment in Github using curl and a GraphQL updateIssueComment mutation

夙愿已清 提交于 2021-01-29 05:33:15
问题 I want to update a comment in a Github PR or issue and I found it hard to find a working example. That's why I ask this question, to answer it myself. Hopefully someone else can use this. 回答1: The following snippet will update an issue or PR comment using a GraphQL mutation and curl. Make sure you replace <REPLACE WITH YOUR GITHUB PERSONAL ACCESS TOKEN> with an access token that has repo scope on the repo in which the PR/issue appears. Then replace the REPLACE WITH COMMENT NODE ID with the

How do I check if a channel exists on YouTube?

≯℡__Kan透↙ 提交于 2021-01-29 05:12:20
问题 If I make a curl request for this URL: https://www.googleapis.com/youtube/v3/channels?part=snippet%2CcontentDetails%2Cstatistics&id=UC_x5XG1OVP6uZZ5FSM9Ttw&key=... I'll get the output as: { "kind": "youtube#channelListResponse", "etag": "J801W-IQ15sDpy3GjDfjlUgoVxA", "pageInfo": { "resultsPerPage": 0 } } Does this mean that the YouTube channel doesn't exist? I don't get any error; how to find whether this is a valid channel or not? Likewise, I want the list of videos of a given channel. If I

Stress testing URI using xargs + curls bash script failing with status empty

半腔热情 提交于 2021-01-29 05:09:47
问题 I'm trying to do user acceptance testing on an application which becomes unresponsive on a particular URL parameter included in the GET request. Steps I have curl and run the GET req (crafted) copied curl syntax for Unix and copied to ubuntu server along with some changes. 'https://abc.ai/getMultiDashboard/demouser' -H 'Cookie: _ga=GA1.2.561275388.1601468723; _hjid=ecd3d778-b7f5-4f7f-b3ef-6f9f12b13d66; 54651cc_an=4; _gid=GA1.2.1366208807.1601560229; _hjTLDTest=1; 54651cc_data

How do I check if a channel exists on YouTube?

大憨熊 提交于 2021-01-29 05:07:51
问题 If I make a curl request for this URL: https://www.googleapis.com/youtube/v3/channels?part=snippet%2CcontentDetails%2Cstatistics&id=UC_x5XG1OVP6uZZ5FSM9Ttw&key=... I'll get the output as: { "kind": "youtube#channelListResponse", "etag": "J801W-IQ15sDpy3GjDfjlUgoVxA", "pageInfo": { "resultsPerPage": 0 } } Does this mean that the YouTube channel doesn't exist? I don't get any error; how to find whether this is a valid channel or not? Likewise, I want the list of videos of a given channel. If I

Understanding curl POST request command that contains multiple Content-Type headers

别来无恙 提交于 2021-01-29 05:05:31
问题 The following curl command: curl -v -F 'json={"method":"update_video","params":{"video":{"id":"582984001","itemState":"INACTIVE"},"token":"jCoXH5OAMYQtXm1sg62KAF3ysG90YLagEECDAdlhg.."}}' https://api.somewebservice.com/services/post Produces this output: {"method":"update_video","params":{"video":{"id":"55269001","itemState":"INACTIVE"},"token":"jCoXH1sg62KAF3ysG90YLagEECTP16uOUSg_fDAdlhg.."}}' https://api.somewebservice.com/services/post * Trying 64.74.101.65... * Connected to api

一文教你实现 SpringBoot 中的自定义 Validator 和错误信息国际化配置

若如初见. 提交于 2021-01-29 04:31:28
一文教你实现 SpringBoot 中的自定义 Validator 和错误信息国际化配置 码农唐磊 程序猿石头 本文通过示例说明,在 Springboot 中如何自定义 Validator,以及如何实现国际化的错误信息返回。注意,本文代码千万别直接照抄,有可能会出大事情的。先留个悬念,读者朋友们能从中看出有什么问题吗? 项目初始化入 直接从 springboot 官网中下载模板,直接通过示例中的 GreetingController 添加实现逻辑。 @RestController public class GreetingController { private static final String template = "Hello, %s!"; private final AtomicLong counter = new AtomicLong(); @RequestMapping("/greeting") public Response<Greeting> greeting(@RequestParam(value = "name", defaultValue = "World") String name) { if (!"tangleithu".equals(name)) { throw new BadRequestException("user.notFound"); }

高性能 Nginx HTTPS 调优!为 HTTPS 提速 30%

半腔热情 提交于 2021-01-29 04:20:57
为什么要优化 Ngin HTTPS 延迟 Nginx 常作为最常见的服务器,常被用作负载均衡 (Load Balancer)、反向代理 (Reverse Proxy),以及网关 (Gateway) 等等。一个配置得当的 Nginx 服务器单机应该可以期望承受住 50K 到 80K 左右每秒的请求,同时将 CPU 负载在可控范围内。 但在很多时候,负载并不是需要首要优化的重点。比如对于卡拉搜索来说,我们希望用户在每次击键的时候,可以体验即时搜索的感觉,也就是说,每个搜索请求必须在 100ms - 200ms 的时间内端对端地返回给用户,才能让用户搜索时没有“卡顿”和“加载”。因此,对于我们来说,优化请求延迟才是最重要的优化方向。 这篇文章中,我们先介绍 Nginx 中的 TLS 设置有哪些与请求延迟可能相关,如何调整才能最大化加速。然后我们用优化卡拉搜索Nginx 服务器的实例来分享如何调整 Nginx TLS/SSL 设置,为首次搜索的用户提速 30% 左右。我们会详细讨论每一步我们做了一些什么优化,优化的动机和效果。希望可以对其它遇到类似问题的同学提供帮助。 TLS 握手和延迟 很多时候开发者会认为:如果不是绝对在意性能,那么了解底层和更细节的优化没有必要。这句话在很多时候是恰当的,因为很多时候复杂的底层逻辑必须包起来,才能让更高层的应用开发复杂度可控。比如说