Guest User

Untitled

a guest
Jan 12th, 2016
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.91 KB | None | 0 0
  1. #for Errno::ENOENT at /
  2. #No such file or directory - ["https://scontent.xx.fbcdn.net/hprofile-xpa1/v/t1.0-1/p720x720/12096589_1495421344087950_7262794375923311339_n.jpg?oh=e30bafeb3343f37e1ff4b043a1d9e40a&oe=570956A5"]
  3. #file: open-uri.rb location: initialize line: 35
  4.  
  5.      @graph = Koala::Facebook::API.new(session['access_token'])
  6.      idofme = @graph.get_object("me") { |data| data['id'] }
  7.  
  8. #produces Errno::ENOENT error
  9. imgofme = "http://graph.facebook.com/#{idofme}/picture?width=500"
  10. httpc = HTTPClient.new
  11. resp = httpc.get(imgofme)
  12. imgofme2= resp.header['Location'].to_s
  13. download = open(imgofme2)
  14. IO.copy_stream(download, './temp.png')
  15.  
  16. #but this works
  17. #imgofme3="https://scontent.xx.fbcdn.net/hprofile-xpa1/v/t1.0-1/p720x720/12096589_1495421344087950_7262794375923311339_n.jpg?oh=e30bafeb3343f37e1ff4b043a1d9e40a&oe=570956A5"
  18. #download = open(imgofme3)
  19. #IO.copy_stream(download, './temp.png')
Advertisement
Add Comment
Please, Sign In to add comment