Gmail atom feed

I’m trying to use basic auth to retrieve my Gmail atom feed but I keep
on
getting “Connection reset by peer”.

Here’s the code:

$URL_FEED = ‘https://mail.google.com/mail/feed/atom

def retrieve
puts “Retrieving mail count…”
@url = URI.parse($URL_FEED)
h = Net::HTTP.new(@url.host,@url.port)
begin
unpw = [@email,@password]
unpw = @unpw.join(’:’)
z=[unpw].pack(“m”)
@unpwd={‘Authorization’ => 'Basic ’ + z }
puts @unpwd
resp = h.get(@url.path,@unpwd)
@headers = “”
resp.each {|key,val| @headers.concat("#{key}: #{val}\n")}
puts @response.body
rescue Net::ProtoFatalError => detail
head = detail.data
head.each {|key,val| puts “#{key} #{val}”}
end
end

On Wed, May 23, 2007 at 12:01:14AM +0900, Fred P. wrote:

   h = Net::HTTP.new(@url.host,@url.port)
   rescue Net::ProtoFatalError => detail
       head = detail.data
       head.each {|key,val| puts "#{key} #{val}"}
   end

end

This is HTTPS. See /usr/lib/ruby/1.8/net/https.rb (or the equivalent on
your
system) for an example of how to use HTTPS URLs.

I only have:
ftp.rb http.rb imap.rb pop.rb protocol.rb smtp.rb telnet.rb

in my net/ directory

On Wed, May 23, 2007 at 12:39:52AM +0900, Fred P. wrote:

I only have:
ftp.rb http.rb imap.rb pop.rb protocol.rb smtp.rb telnet.rb

in my net/ directory

So, let me guess - you’re using Ubuntu or Debian, right? If so you’ll
need

apt-get install libopenssl-ruby1.8

If not, then please describe your system.

(Aside: This really belongs in a FAQ.

  1. Always state exactly what system you’re running under.
  2. If running Debian/Ubuntu, Ruby is broken into shrapnel packages)

Thanks, it’s working perfectly now.

On May 22, 2007, at 1:24 PM, Brian C. wrote:

If not, then please describe your system.

(Aside: This really belongs in a FAQ.

  1. Always state exactly what system you’re running under.
  2. If running Debian/Ubuntu, Ruby is broken into shrapnel packages)

And if you are using Debian Etch (4.0), you can use this script:

http://pastie.caboo.se/63595

That I put together from:

#=======================================================================

Based on the Rails stack script from RimuHosting

#-----------------------------------------------------------------------

Written by Peter over at RimuHosting.com (we provide Linux VPS

hosting services)

Last major update: 2006-06-18

for a bit of a blurb about this script see

http://bliki.rimuhosting.com/space/knowledgebase/linux/

miscapplications/ruby+on+rails

the latest version of this script is typically found at http://

downloads.rimuhosting.com/miscproj/rails.sh
#=======================================================================

and the blog post by Mike M.:

"compiling ruby 1.8.5 w/ openssl on Debian (Etch/testing) and

FreeBSD in $HOME"
#-----------------------------------------------------------------------

#http://blog.mondragon.cc/articles/2007/02/03/compiling-ruby-1-8-5-w-
openssl-on-debian-etch-testing-and-freebsd-in-home
#=======================================================================

If you don’t have root access on your system, then take a look at the
script and make the appropriate modifications. Mike M.'s
article specifically addresses building in a local directory where
you don’t have the permission to put things in the “global” place in
the filesystem.

-Rob

Rob B. http://agileconsultingllc.com
[email protected]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs