论坛首页 编程语言技术论坛

飞信的ruby gem──rfetion

浏览 29583 次
精华帖 (12) :: 良好帖 (5) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2009-10-16  
flyerhzm 写道
山雨欲来风满楼 写道
测试了一下 ,

Fetion Error: Login failed.

终端必须要装 PC 3.2.0540 版本吗? 我装了个最新的有影响吗?


Fetion Error: Login failed. 是因为登录失败,请检查输入的手机号和密码
应该和终端的版本没有关系,我在herohu上面都可以发送短信的
附上源码:
    @logger.info "fetion login"
    uri = URI.parse(FETION_LOGIN_URL + "?mobileno=#{@mobile_no}&pwd=#{@password}")
    http = Net::HTTP.new(uri.host, uri.port)
    http.use_ssl = true 
    http.verify_mode = OpenSSL::SSL::VERIFY_NONE
    headers = {'Content-Type' => 'application/oct-stream', 'Pragma' => "xz4BBcV#{GUID}", 'User-Agent' => 'IIC2.0/PC 3.2.0540'}
    response = http.request_get(uri.request_uri, headers)

    raise FetionException.new('Fetion Error: Login failed.') unless response.is_a? Net::HTTPSuccess

0 请登录后投票
   发表时间:2009-10-16  
flyerhzm 写道
山雨欲来风满楼 写道
测试了一下 ,

Fetion Error: Login failed.

终端必须要装 PC 3.2.0540 版本吗? 我装了个最新的有影响吗?


Fetion Error: Login failed. 是因为登录失败,请检查输入的手机号和密码
应该和终端的版本没有关系,我在herohu上面都可以发送短信的
附上源码:
    @logger.info "fetion login"
    uri = URI.parse(FETION_LOGIN_URL + "?mobileno=#{@mobile_no}&pwd=#{@password}")
    http = Net::HTTP.new(uri.host, uri.port)
    http.use_ssl = true 
    http.verify_mode = OpenSSL::SSL::VERIFY_NONE
    headers = {'Content-Type' => 'application/oct-stream', 'Pragma' => "xz4BBcV#{GUID}", 'User-Agent' => 'IIC2.0/PC 3.2.0540'}
    response = http.request_get(uri.request_uri, headers)

    raise FetionException.new('Fetion Error: Login failed.') unless response.is_a? Net::HTTPSuccess

0 请登录后投票
   发表时间:2009-10-16  
多谢答复。

另外,我是在windows上跑的,不知道有没有关系?

另外,是不是需要设置其他环境,如安全证书?看上去不用。

手机号码是我自己的手机, 密码是PC上飞信登录密码,应该不会弄错,

for example:

Fetion.send_sms_to_self('13967426512', 'zhyi123#', 'hello') (用双引号也试过)

在Gem 下面 我用了

rfetion -m 13967426512 -p zhyi123# -c hello

报同样的login 失败。

然后再次用pc客户端登陆,提示说密码输入连续出错, 这说明手机号码是发对了, 密码有问题,但是我奇怪密码应该不会弄错的吧。

哎, 希望能够很快解决,然后和大家一起来研究rfetion这个工具。

0 请登录后投票
   发表时间:2009-10-16  
山雨欲来风满楼 写道
多谢答复。

另外,我是在windows上跑的,不知道有没有关系?

另外,是不是需要设置其他环境,如安全证书?看上去不用。

手机号码是我自己的手机, 密码是PC上飞信登录密码,应该不会弄错,

for example:

Fetion.send_sms_to_self('13967426512', 'zhyi123#', 'hello') (用双引号也试过)

在Gem 下面 我用了

rfetion -m 13967426512 -p zhyi123# -c hello

报同样的login 失败。

然后再次用pc客户端登陆,提示说密码输入连续出错, 这说明手机号码是发对了, 密码有问题,但是我奇怪密码应该不会弄错的吧。

哎, 希望能够很快解决,然后和大家一起来研究rfetion这个工具。



我到没有在windows下面测试过,有没有在windows下面发送成功的同学啊?
0 请登录后投票
   发表时间:2009-10-16  
确实是密码弄错了,在windos下的gem,发送给自己和好友短信全部可以收到。

如果有新的收获,将会分享给大家。 显然这个一个非常好的工具。

特别感谢 大牛 flyerhzm !
0 请登录后投票
   发表时间:2009-10-22  
我这里发生一个很奇怪的情况,开始的时候能很好的使用API发送短信,给自己给朋友都可以.但是隔了一天就不行了,出现了前面说到的这个空指针的错误,请flyerhzm指教下.
wangxin0072000 写道
C:/Ruby/lib/ruby/gems/1.8/gems/uuid-2.0.2/lib/uuid.rb:265:in `read_state': undefined method `unpack' for nil:NilClass (NoMethodError)
        from C:/Ruby/lib/ruby/gems/1.8/gems/uuid-2.0.2/lib/uuid.rb:224:in `next_sequence'
        from C:/Ruby/lib/ruby/gems/1.8/gems/uuid-2.0.2/lib/uuid.rb:255:in `open_lock'
        from C:/Ruby/lib/ruby/gems/1.8/gems/uuid-2.0.2/lib/uuid.rb:252:in `open'
        from C:/Ruby/lib/ruby/gems/1.8/gems/uuid-2.0.2/lib/uuid.rb:252:in `open_lock'
        from C:/Ruby/lib/ruby/gems/1.8/gems/uuid-2.0.2/lib/uuid.rb:223:in `next_sequence'
        from C:/Ruby/lib/ruby/gems/1.8/gems/uuid-2.0.2/lib/uuid.rb:160:in `initialize'
        from C:/Ruby/lib/ruby/gems/1.8/gems/rfetion-0.1.4/lib/rfetion/fetion.rb:12:in `new'
        from C:/Ruby/lib/ruby/gems/1.8/gems/rfetion-0.1.4/lib/rfetion/fetion.rb:12
        from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from C:/Ruby/lib/ruby/gems/1.8/gems/rfetion-0.1.4/lib/rfetion.rb:8
        from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
        from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
        from C:/study/regular_express/lib/main.rb:3

0 请登录后投票
   发表时间:2009-10-22   最后修改:2009-10-22
c00lspig 写道
我这里发生一个很奇怪的情况,开始的时候能很好的使用API发送短信,给自己给朋友都可以.但是隔了一天就不行了,出现了前面说到的这个空指针的错误,请flyerhzm指教下.
wangxin0072000 写道
C:/Ruby/lib/ruby/gems/1.8/gems/uuid-2.0.2/lib/uuid.rb:265:in `read_state': undefined method `unpack' for nil:NilClass (NoMethodError)
        from C:/Ruby/lib/ruby/gems/1.8/gems/uuid-2.0.2/lib/uuid.rb:224:in `next_sequence'
        from C:/Ruby/lib/ruby/gems/1.8/gems/uuid-2.0.2/lib/uuid.rb:255:in `open_lock'
        from C:/Ruby/lib/ruby/gems/1.8/gems/uuid-2.0.2/lib/uuid.rb:252:in `open'
        from C:/Ruby/lib/ruby/gems/1.8/gems/uuid-2.0.2/lib/uuid.rb:252:in `open_lock'
        from C:/Ruby/lib/ruby/gems/1.8/gems/uuid-2.0.2/lib/uuid.rb:223:in `next_sequence'
        from C:/Ruby/lib/ruby/gems/1.8/gems/uuid-2.0.2/lib/uuid.rb:160:in `initialize'
        from C:/Ruby/lib/ruby/gems/1.8/gems/rfetion-0.1.4/lib/rfetion/fetion.rb:12:in `new'
        from C:/Ruby/lib/ruby/gems/1.8/gems/rfetion-0.1.4/lib/rfetion/fetion.rb:12
        from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from C:/Ruby/lib/ruby/gems/1.8/gems/rfetion-0.1.4/lib/rfetion.rb:8
        from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
        from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
        from C:/study/regular_express/lib/main.rb:3



试试看修改uuid.rb源码,注释掉140行,改为
#state_dir = File.join('', 'var', 'tmp')
state_dir = '.'

0 请登录后投票
   发表时间:2009-10-23  
flyerhzm 写道
c00lspig 写道
我这里发生一个很奇怪的情况,开始的时候能很好的使用API发送短信,给自己给朋友都可以.但是隔了一天就不行了,出现了前面说到的这个空指针的错误,请flyerhzm指教下.
C:/Ruby/lib/ruby/gems/1.8/gems/uuid-2.0.2/lib/uuid.rb:265:in `read_state': undefined method `unpack' for nil:NilClass (NoMethodError)
        from C:/Ruby/lib/ruby/gems/1.8/gems/uuid-2.0.2/lib/uuid.rb:224:in `next_sequence'
        from C:/Ruby/lib/ruby/gems/1.8/gems/uuid-2.0.2/lib/uuid.rb:255:in `open_lock'
        from C:/Ruby/lib/ruby/gems/1.8/gems/uuid-2.0.2/lib/uuid.rb:252:in `open'
        from C:/Ruby/lib/ruby/gems/1.8/gems/uuid-2.0.2/lib/uuid.rb:252:in `open_lock'
        from C:/Ruby/lib/ruby/gems/1.8/gems/uuid-2.0.2/lib/uuid.rb:223:in `next_sequence'
        from C:/Ruby/lib/ruby/gems/1.8/gems/uuid-2.0.2/lib/uuid.rb:160:in `initialize'
        from C:/Ruby/lib/ruby/gems/1.8/gems/rfetion-0.1.4/lib/rfetion/fetion.rb:12:in `new'
        from C:/Ruby/lib/ruby/gems/1.8/gems/rfetion-0.1.4/lib/rfetion/fetion.rb:12
        from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from C:/Ruby/lib/ruby/gems/1.8/gems/rfetion-0.1.4/lib/rfetion.rb:8
        from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
        from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
        from C:/study/regular_express/lib/main.rb:3



试试看修改uuid.rb源码,注释掉140行,改为
#state_dir = File.join('', 'var', 'tmp')
state_dir = '.'


还是不行  调试成功后就没有动过任何地方了    晕的很
0 请登录后投票
   发表时间:2009-10-23  
c00lspig 写道
flyerhzm 写道
c00lspig 写道
我这里发生一个很奇怪的情况,开始的时候能很好的使用API发送短信,给自己给朋友都可以.但是隔了一天就不行了,出现了前面说到的这个空指针的错误,请flyerhzm指教下.
C:/Ruby/lib/ruby/gems/1.8/gems/uuid-2.0.2/lib/uuid.rb:265:in `read_state': undefined method `unpack' for nil:NilClass (NoMethodError)
        from C:/Ruby/lib/ruby/gems/1.8/gems/uuid-2.0.2/lib/uuid.rb:224:in `next_sequence'
        from C:/Ruby/lib/ruby/gems/1.8/gems/uuid-2.0.2/lib/uuid.rb:255:in `open_lock'
        from C:/Ruby/lib/ruby/gems/1.8/gems/uuid-2.0.2/lib/uuid.rb:252:in `open'
        from C:/Ruby/lib/ruby/gems/1.8/gems/uuid-2.0.2/lib/uuid.rb:252:in `open_lock'
        from C:/Ruby/lib/ruby/gems/1.8/gems/uuid-2.0.2/lib/uuid.rb:223:in `next_sequence'
        from C:/Ruby/lib/ruby/gems/1.8/gems/uuid-2.0.2/lib/uuid.rb:160:in `initialize'
        from C:/Ruby/lib/ruby/gems/1.8/gems/rfetion-0.1.4/lib/rfetion/fetion.rb:12:in `new'
        from C:/Ruby/lib/ruby/gems/1.8/gems/rfetion-0.1.4/lib/rfetion/fetion.rb:12
        from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from C:/Ruby/lib/ruby/gems/1.8/gems/rfetion-0.1.4/lib/rfetion.rb:8
        from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
        from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
        from C:/study/regular_express/lib/main.rb:3



试试看修改uuid.rb源码,注释掉140行,改为
#state_dir = File.join('', 'var', 'tmp')
state_dir = '.'


还是不行  调试成功后就没有动过任何地方了    晕的很


我这里没有windows环境,没办法帮你调试。
不过问题应该是在uuid那个gem上,我的调用是
GUID = UUID.new.generate

要不去问问uuid的作者
实在不行我找找看有没有其它的解决方案
0 请登录后投票
   发表时间:2009-10-25   最后修改:2009-10-25
flyerhzm 写道

实在不行我找找看有没有其它的解决方案


也出现了类似的问题 
觉得依赖的gem太多,不好管理, 我用了两个插件解决了(也可以合成一个插件,不过那个类太常用了觉得没必要)
可以看下
太多了就没在这里回复
可以看下这篇文章

http://rubyrails.iteye.com/blog/503547
0 请登录后投票
论坛首页 编程语言技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics