问题标签 [typhoeus]

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 回答
2214 浏览

ruby - Ruby Typhoeus gem - 体内的 Json 无效?

我有以下代码:

这将返回一个响应代码400和一个错误:

Content-Type set to application/json but could not decode valid JSON in request body.

以下是我正在进行的 API 调用的文档:http: //docs.fluidsurveys.com/api/webhooks.html

样品请求(根据文档):

我在这里做错了什么?调查和收集器是可选参数,我没有看到我体内的 json 有问题。

0 投票
1 回答
1408 浏览

ruby-on-rails - Apple Receipt Validation 21002 From Ruby on Rails with Typhoeus Gem

我有一些 Rails 代码,它从 Apple 获得应用内购买收据,并针对沙盒或生产验证它。这工作得很好,但最近我在我的日志中看到了一些 21002(receipt-data 属性中的数据格式错误)错误。我可以看到这些来自生产中的应用程序。

下面是我验证收据的 RoR 代码,您是否看到任何会导致 21002 的内容?

非常感谢!

0 投票
0 回答
604 浏览

ruby-on-rails - Typhoeus 无法使用 https 在 ubuntu 上工作

我正在尝试GET通过 SSL 发出请求,并将响应代码0设为空白,将响应正文设为空白。

要求

Typhoeus::Request.get("https://www.example.com", headers: { 'Accept' => "application/json"}, ssl_verifypeer: false, userpwd: 'username' + ":" + 'pwd', sslversion: :sslv3))

回复:

"ETHON: performed EASY url= response_code=0 return_code=peer_failed_verification total_time=0.22201"

相同的 URL 通过 CURL 在终端上运行,它也在 mac 机器上运行。

0 投票
2 回答
3427 浏览

ruby - 台风Windows安装

尝试在 Windows 7 环境中安装 Typhoeus。Gem 安装成功,但在尝试运行简单的 ruby​​ 脚本时:: require 'typhoeus'

Typhoeus.get("www.google.com", 详细: true)

我收到以下错误:: D:/Ruby193/lib/ruby/gems/1.9.1/gems/ffi-1.9.3-x86-mingw32/lib/ffi/library.rb:133:in `block in ffi_lib' : 无法打开 l (LoadError)url': 找不到指定的模块。. 无法打开库“libcurl.dll”:找不到指定的模块。. 无法打开库“libcurl.so.4”:找不到指定的模块。

我尝试添加我在 curl 网站上的一个包中找到的 curl.exe 和 libcurl.dll ,但这没有帮助。不知道此时该做什么。谢谢。

0 投票
1 回答
465 浏览

ruby - 来自浏览器的良好请求但来自 ruby​​ 的错误请求?

我正在使用谷歌自定义搜索 api,我正在尝试通过一些 ruby​​ 代码访问它:

这是代码片段

答案的主体似乎是这个:

当我尝试从浏览器做同样的事情时,它就像一个魅力。更令人困惑的是,同样的代码在 12 小时前工作。我只更改了它应该查找的关键字,但是它开始返回错误。

有什么建议么?我确定我有足够的积分来处理更多请求

0 投票
0 回答
225 浏览

ruby - Typhoeus gem 未获取主 IP

我正在使用 Typhoeus gem 来运行 HTTP 请求。但是当我在另一个系统中运行时,它运行良好并返回正确的主 IP。但在我的系统中,它没有给出主 IP——而是返回 nil。

我的代码就像

在另一个系统中的响应:

Typhoeus::Response:0xb45c1f70 @options={:httpauth_avail=>0, :total_time=>0.101638, :starttransfer_time=>0.10146, :appconnect_time=>0.0, :pretransfer_time=>0.035663, :connect_time=>0.035659, :namelookup_time=> 0.00018, :effective_url=>" http://www.google.com ", :primary_ip=>"74.125.236.48", :response_code=>405, :redirect_count=>0, :return_code=>:ok,

我的系统中的响应:

Typhoeus::Response:0xbc9704c @options={:httpauth_avail=>0, :total_time=>0.589821, :starttransfer_time=>0.419524, :appconnect_time=>nil, :pretransfer_time=>0.194883, :connect_time=>0.194829, :namelookup_time=> 0.02522, :effective_url=>" http://www.google.com ", :primary_ip=>nil, :response_code=>200, :redirect_count=>0, :return_code=>:ok,

我想知道为什么会这样。我正在等待好的答案。

更新

来自另一个系统的完整响应:

Typhoeus::Response:0xb4cebdb4 @options={:httpauth_avail=>0, :total_time=>0.077503, :starttransfer_time=>0.077249, :appconnect_time=>0.0, :pretransfer_time=>0.013626, :connect_time=>0.01362, :namelookup_time=> 0.000143, :effective_url=>" http://www.google.com ", :primary_ip=>"74.125.236.50", :response_code=>405, :redirect_count=>0, :return_code=>:ok, :response_headers= >"HTTP/1.1 405 Method Not Allowed\r\nAllow: GET, HEAD\r\nDate: Thu, 10 Apr 2014 12:42:44 GMT\r\nContent-Type: text/html; charset=UTF-8\ r\n服务器:gws\r\n内容长度:1453\r\nX-XSS-保护:1;模式=块\r\nX-Frame-Options:SAMEORIGIN\r\n备用协议:80:quic\r\ n\r\n", :response_body=>"\n\n \n \n 错误 405(方法不允许)!!1\n \n {margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max -宽度:390 像素;最小高度:180 像素;填充:30 像素 0 15 像素}> body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{ color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding- right:0}}#logo{background:url(//www.google.com/images/errors/logo_sm_2.png) no-repeat}@media only screen and (min-resolution:192dpi){#logo{background: url(//www.google.com/images/errors/logo_sm_2_hr.png) 无重复 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/ errors/logo_sm_2_hr.png) 0}}@media 仅屏幕和 (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/errors/logo_sm_2_hr. png) 不重复;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:55px;width:150px}\n \n \n

405.那\xE2\x80\x99是一个错误。\n

请求方法POST不适合 URL /。我们所知道的\xE2\x80\x99s。\n", :debug_info=>#}, @request=#:post}, @options={:method=>:post, :headers=>{"User-Agent "=>"Typhoeus - https://github.com/typhoeus/typhoeus "}, :maxredirs=>50}, @on_headers=[], @response=#, @on_complete=[], @on_failure=[]>

来自我的系统的完整响应:

Typhoeus::Response:0xbf277e4 @options={:httpauth_avail=>0, :total_time=>0.542332, :starttransfer_time=>0.374829, :appconnect_time=>nil, :pretransfer_time=>0.192083, :connect_time=>0.192035, :namelookup_time=> 0.025185, :effective_url=>" http://www.google.com", :primary_ip=>nil, :response_code=>200, :redirect_count=>0, :return_code=>:ok, :response_headers=>"HTTP/1.1 200 OK\r\n日期:2014 年 4 月 10 日星期四 12:44 :38 GMT\r\n过期:-1\r\n缓存控制:私有,max-age=0\r\n内容类型:文本/html;charset=ISO-8859-1\r\nSet-Cookie: PREF=ID=075796115d23a806:FF=0:TM=1397133878:LM=1397133878:S=9K9PiB355V_pLs56; expires=星期六,2016 年 4 月 9 日 12:44:38 GMT;路径=/; domain=.google.com\r\nSet-Cookie: NID=67=lbUdPyBSFruSAjPvOJZJhr25WNN43JzP--0oYtYxHvMxYYJqeWZBj8wRZi6qMPxw7XPHHylholrcflVZ-SpIdci8GL_guJcfAnh1O8XJHKQb3Qu67MA62L-bhlCbvgST; 过期=格林威治标准时间 2014 年 10 月 10 日星期五 12:44:38;路径=/; 域=.google.com;HttpOnly\r\nP3P: CP=\"这不是 P3P 政策!请参阅http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=151657png) 0 -258px 重复 x;边框:无;颜色:#000;光标:指针;高度:30 像素;边距:0;轮廓:0;字体:15 像素 arial,无衬线;垂直对齐:顶部}。 lsb:active{background:#ccc}.lst:focus{outline:none}#addlang a{padding:0 3px}(function(){var src='/images/nav_logo176.png';var iesg=false;document .body.onload = function(){window.n && window.n();if (document.images){new Image().src=src;}\nif (!iesg){document.f&&document.fqfocus() ;document.gbqf&&document.gbqf.q.focus();}\n}\n})(); 搜索 http://www.google.com/imghp?hl=en&tab=wi\">图片 http://maps.google.com/maps?hl=en&tab=wl\">地图 https://play.google .com/?hl=en&tab=w8\">播放 http://www.youtube.com/?tab=w1\">YouTube http://news.google.com/nwshp?hl=en&tab=wn\" >新闻 https://mail.google.com/mail/?tab=wm\">Gmail https:

 高级搜索语言工具
广告程序商业解决方案https://plus.google.com/116899029375914044550\" rel=\"publisher\">+GoogleAbout Google© 2013 - 隐私和条款

if(google.y)google.y.first=[];(function(){function b(a){window.setTimeout(function(){var c=document.createElement(\"script\");c. src=a;document.getElementById(\"xjsd\").appendChild(c)},0)}google.dljp=function(a){google.xjsu=a;b(a)};google.dlj=b ;})();\nif(!google.xjs){window._=window._||{};window._._DumpException=function(e){throw e};if(google.timers&&google.timers. load.t){google.timers.load.t.xjsls=new Date().getTime();}google.dljp('/xjs/_/js/k\\x3dxjs.hp.en_US.75bv2nh_qxI.O/ m\\x3dsb_he,pcc/rt\\x3dj/d\\x3d1/sv\\x3d1/rs\\x3dAItRSTOX5WMsAVpkgEafYeVKZ7ZCJdNXcg');google.xjs=1;}google.pmc={\"sb_he\":{\" agen\":true,\"cgen\":true,\"client\":\"heirloom-hp\",\"dh\":true,\"ds\":\"\",\"eqch \":真,\"fl\":真,\"host\":\"google.com\",\"jam\":0,\"jsonp\":true,\"msgs\":{\"dym\":\"你的意思是:\", \"lcky\":\"I\\u0026#39;m 手气\",\"lml\":\"了解更多\",\"oskt\":\"输入工具\",\"psrc \":\"此搜索已从您的 \\u003Ca href=\\\"/history\\\"\\u003EWeb History\\u003C/a\\u003E\",\"psrl\":\"删除\",\"sbit\":\"按图片搜索\",\"srch\":\"谷歌搜索\"},\"ovr\":{},\"pq\":\"\" ,\"qcpw\":false,\"scd\":10,\"sce\":5,\"stok\":\"nXO_Z2rNte7VdOqPtwZ_V-hNE4c\"},\"pcc\":{}}; google.y.first.push(function(){if(google.med){google.med('init');google.initHistory();google.med('history');}});if(google.j&&google.j.en&&google.j.xi){window.setTimeout(google.j.xi,0);}(function() {if(google.timers&&google.timers.load.t){var b,c,d,e,g=function(a,f){a.removeEventListener?(a.removeEventListener(\"load\",f,! 1),a.removeEventListener(\"error\",f,!1)):(a.detachEvent(\"onload\",f),a.detachEvent(\"onerror\",f))},h =function(a){e=(new Date).getTime();++c;a=a||window.event;a=a.target||a.srcElement;g(a,h)},k =document.getElementsByTagName(\"img\");b=k.length;for(var l=c=0,m;l", :debug_info=>#}, @request=#:post}, @options= {:method=>:post, :headers=>{"User-Agent"=>"Typhoeus -0);}(function(){if(google.timers&&google.timers.load.t){var b,c,d,e,g=function(a,f){a.removeEventListener?(a.removeEventListener(\ "load\",f,!1),a.removeEventListener(\"error\",f,!1)):(a.detachEvent(\"onload\",f),a.detachEvent(\"onerror\ ",f))},h=function(a){e=(new Date).getTime();++c;a=a||window.event;a=a.target||a.srcElement;g (a,h)},k=document.getElementsByTagName(\"img\");b=k.length;for(var l=c=0,m;l", :debug_info=>#}, @request= #:post}, @options={:method=>:post, :headers=>{"User-Agent"=>"Typhoeus -0);}(function(){if(google.timers&&google.timers.load.t){var b,c,d,e,g=function(a,f){a.removeEventListener?(a.removeEventListener(\ "load\",f,!1),a.removeEventListener(\"error\",f,!1)):(a.detachEvent(\"onload\",f),a.detachEvent(\"onerror\ ",f))},h=function(a){e=(new Date).getTime();++c;a=a||window.event;a=a.target||a.srcElement;g (a,h)},k=document.getElementsByTagName(\"img\");b=k.length;for(var l=c=0,m;l", :debug_info=>#}, @request= #:post}, @options={:method=>:post, :headers=>{"User-Agent"=>"Typhoeus -detachEvent(\"onerror\",f))},h=function(a){e=(new Date).getTime();++c;a=a||window.event;a=a.target| |a.srcElement;g(a,h)},k=document.getElementsByTagName(\"img\");b=k.length;for(var l=c=0,m;l", :debug_info=> #}, @request=#:post}, @options={:method=>:post, :headers=>{"User-Agent"=>"Typhoeus -detachEvent(\"onerror\",f))},h=function(a){e=(new Date).getTime();++c;a=a||window.event;a=a.target| |a.srcElement;g(a,h)},k=document.getElementsByTagName(\"img\");b=k.length;for(var l=c=0,m;l", :debug_info=> #}, @request=#:post}, @options={:method=>:post, :headers=>{"User-Agent"=>"Typhoeus -https://github.com/typhoeus/typhoeus "}, :maxredirs=>50}, @on_headers=[], @response=#, @on_complete=[], @on_success=[]>

0 投票
2 回答
130 浏览

ruby-on-rails - 执行 HTTP 请求时出错

我正在使用 Typhoeus gem 在我的 rails 应用程序中执行 HTTP 请求。请求如下。

在执行此操作时,auth_token 已转换为 auth%5Ftoken=abcd。实际上我的 API 需要参数 auth_token。因为这个 API 不允许访问它。它抛出未经授权的错误。请帮我解决这个问题。提前致谢。

0 投票
0 回答
162 浏览

ruby - 如何在不编码的情况下发送 HTTP_REQUEST?

我想发送一个请求而不编码参数。因为我的 API 期望参数为 auth_token,但在发送请求时它被编码为 auth%5Ftoken。因此,它的抛出错误。请帮我发送不带编码的请求。我正在使用健身房 Typhoeus 发送 http 请求。

我的代码:

0 投票
1 回答
174 浏览

ruby-on-rails - 不能将 typhoeus 包含在我的 ruby​​ on rails 项目中

我试图包括像以下这样的台风:

但我在日志文件中看到:

我将它包含在 gem 文件中,但我不知道我做错了什么

0 投票
0 回答
128 浏览

ruby - 从测试服务器提出请求时出现 Typhoeus 问题

我正在使用 Typhoeus gem 将 http 请求发送到 API。它在我的系统上工作。但是,从 TESTING 服务器发送相同的内容时,它没有给出所需的响应。我想知道可能是什么问题?请帮我。

我的代码: