httpie

HTTPie

只谈情不闲聊 提交于 2020-11-25 02:48:15
HTTPie 使 curl http请求更直观,语法高亮 支持JSON格式 而且跨平台 brew install httpie 官网:https://httpie.org/#installation 来源: oschina 链接: https://my.oschina.net/u/923974/blog/1842708

Httpie二次封装

做~自己de王妃 提交于 2020-11-25 02:20:06
在centos下安装httpie yum install -y python-pippip install --upgrade httpie 在ubuntu下安装httpie sudo apt-get install httpie 或者 apt-get install -y python-pippip install --upgrade httpie 封装脚本 sudo vim /usr/bin/hpost #!/bin/sh allargs=$@if [ $# -eq 0 ];then echo "Usage: $0 http://www.example.com"exit 0fi t=$(date +%s)key="xxxxxxxxxxxxx"tsp=$(printf $t$key | sha1sum | awk '{ print $1 }')cmdexe="/usr/bin/http -f post $allargs _t=$t _tsp=$tsp User-Agent:iiitp-xxx-yyy-zzz "echo $cmdexe($cmdexe) sudo chmod a+x /usr/bin/hpost #赋予可执行权限 demo: /usr/bin/hpost http://www.iiitp.com 文章地址: http://www.iiitp.com/?post

What is the proper API calling Syntax from Alamofire?

99封情书 提交于 2019-12-25 06:04:04
问题 I am trying to call following API: http -v -a qi.test.ac@gmail.com:pasword -f POST 'http://localhost:8080/api/v1/user/messages' from="qi.test.ac@gmail.com" to={"qi.test.ac@gmail.com","qi_test_ac@yahoo.com"} subject="test_sub" bodyText="testing hello" I successfully called it from terminal using HTTPie using normally above command. Now I want to call it from Alamofire. I have tried in following way: parameters = [ "from" : fromMail, "to" : ["qi.test.ac@gmail.com","qi_test_ac@yahoo.com"] ]

How to send a POST request using HTTPie?

亡梦爱人 提交于 2019-12-18 09:34:36
问题 I have a basic silex application, and I try to test it using HTTPie. Yet when posting using: http POST http://localhost:1337 data="hello world" The data , that I get from the Request object via: $data = $request->request->get('data'); will always be empty. What is the problem here? 回答1: It was an httpie usage problem as the form flag was necessary, as silex requires the parameters to be form-encoded, yet the default of HTTPie is to pass a JSON object. $ http --form POST http://localhost:1337

can't receive monzo access token using axios

丶灬走出姿态 提交于 2019-12-13 03:58:45
问题 I've been trying for the whole day to perform a post request using axios in react (I'm trying to get an access_token for a Monzo app). I've followed the instructions here and they work perfectly when trying them out with the httpie command line tool as illustrated on said instructions. However, when I try to use it from within my react app, things go awry. The post request in question using httpie is as follows: http --form POST "https://api.monzo.com/oauth2/token" \ "grant_type=authorization

simulate an HTTP request with curl

﹥>﹥吖頭↗ 提交于 2019-12-11 15:38:39
问题 I'm trying to debug an HTTP request that produces an error on our server. However, I'm struggling to reproduce the exact request somehow. On my nginx logs, I see this entry which generated the error 157.55.33.20 - - [22/Nov/2013:04:06:22 +0000] "GET /en/library/search?utf8=\xE2\x9C\x93&q=something HTTP/1.1" 500 0 "-" "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)" "-" However, trying to use curl or httpie using the same string produces log entries like: GET /en

如何通过curl调用使用HTTP请求发送标头?

泪湿孤枕 提交于 2019-12-09 18:50:06
我希望在Linux机器上向我的Apache服务器发送一个标头。 如何通过卷曲调用实现此目的? #1楼 得到: 使用JSON: curl -i -H "Accept: application/json" -H "Content-Type: application/json" http://hostname/resource 使用XML: curl -H "Accept: application/xml" -H "Content-Type: application/xml" -X GET http://hostname/resource POST: 用于发布数据: curl --data "param1=value1&param2=value2" http://hostname/resource 对于文件上传: curl --form "fileupload=@filename.txt" http://hostname/resource RESTful HTTP帖子: curl -X POST -d @filename http://hostname/resource 用于登录站点(auth): curl -d "username=admin&password=admin&submit=Login" --dump-header headers http://localhost

强大的HTTPie

夙愿已清 提交于 2019-11-30 14:23:31
HTTPie 是一个非常易用、易于升级的 HTTP 客户端。它的发音为 “aitch-tee-tee-pie” 并以 http 命令 运行,它是一个用 Python 编写的来用于访问 Web 的 命令 行工具。 使用 HTTPie 调试 API,这是一个用 Python 写的易用的命令行工具。 HTTPie 是一个非常易用、易于升级的 HTTP 客户端。它的发音为 “aitch-tee-tee-pie” 并以 http 命令运行,它是一个用 Python 编写的来用于访问 Web 的命令行工具。 由于这是一篇关于 HTTP 客户端的指导文章,因此你需要一个 HTTP 服务器来试用它。在这里,访问 httpbin.org,它是一个简单的开源 HTTP 请求和响应服务。httpbin.org 网站是一种测试 Web API 的强大方式,并能仔细管理并显示请求和响应内容,不过现在让我们专注于 HTTPie 的强大功能。 Wget 和 cURL 的替代品 你可能听说过古老的 Wget 或稍微新一些的 cURL 工具,它们允许你从命令行访问 Web。它们是为访问网站而编写的,而 HTTPie 则用于访问 Web API。 网站请求发生在计算机和正在阅读并响应它所看到的内容的最终用户之间,这并不太依赖于结构化的响应。但是,API 请求会在两台计算机之间进行结构化调用,人并不是该流程内的一部分

Sending nested JSON object using HTTPie

允我心安 提交于 2019-11-28 18:36:10
I am trying to use HTTPie to parse to send some nested JSON object, but I can not find how. It is pretty clear how to send a JSON object but not a nested one such as { "user": { "name": "john" "age": 10 } } You can pass the whole JSON via stdin : $ echo '{ "user": { "name": "john", "age": 10 } }' | http httpbin.org/post Or specify the raw JSON as value with := : $ http httpbin.org/post user:='{"name": "john", "age": 10 }' I like this way: $ http PUT localhost:8080/user <<<'{ "user": { "name": "john" "age": 10 }}' It is preferrable because it has the same prefix as the related commands, and so

Sending nested JSON object using HTTPie

本小妞迷上赌 提交于 2019-11-27 10:27:43
问题 I am trying to use HTTPie to parse to send some nested JSON object, but I can not find how. It is pretty clear how to send a JSON object but not a nested one such as { "user": { "name": "john" "age": 10 } } 回答1: You can pass the whole JSON via stdin: $ echo '{ "user": { "name": "john", "age": 10 } }' | http httpbin.org/post Or specify the raw JSON as value with :=: $ http httpbin.org/post user:='{"name": "john", "age": 10 }' 回答2: I like this way: $ http PUT localhost:8080/user <<<'{ "user": {