5 messages in com.googlegroups.google-picasa-data-apiRe: Picassa Data API possibly caching...
FromSent OnAttachments
m1keb05 Dec 2007 07:25 
Ryan Boyd (Google)05 Dec 2007 10:51 
m1keb05 Dec 2007 14:43 
m1keb06 Dec 2007 10:44 
m1keb07 Dec 2007 10:43 
Subject:Re: Picassa Data API possibly caching user?
From:Ryan Boyd (Google) (api.@google.com)
Date:12/05/2007 10:51:25 AM
List:com.googlegroups.google-picasa-data-api

Hi M1keb,

The service is stateless -- there is no server-side caching of your credentials. While it is possible you have a proxy server in between your host and YT which is caching purely based off the URL (when using 'default' as a username), this generally should not happen due to the use of an Authorization header to send the credentials. Proxy servers should especially not cache in the case of a different URL. However, we've seen weird proxy servers in the past!

I'm not that familiar with rails. The best way to check this out would just be to capture the traffic leaving your server to see the exact requests being made/responses being received. More info on using several different network capture tools with GData APIs is available at: http://code.google.com/support/bin/answer.py?answer=71567&topic=12026

As a side note -- you should not be using ClientLogin in the case of a web application unless you are only using a single username/password belonging to your web application. (ie, you should never be asking someone for their PWA/Google username/password). Please use AuthSub to get a token for accessing a user's data within a web application. More information available at: http://code.google.com/apis/accounts/AuthForWebApps.html

Cheers, -Ryan

On Dec 5, 7:25 am, m1keb <mbuk@gmail.com> wrote:

I'm seeing some very strange behavior retrieving a users' private photos from Picasa into Rails. I know that this issue may be relative to my application but I am fairly certain I have eliminated all the variables. I can parse a user's private photos using the data API but now when I try doing it for a different user I get the first user's data! It's as if the server side is caching my token? To replicate:

1) Add UserA with credentials for Google Data to rails db. 2) Get photos for UserA. Everything works. 3) run rake db:migrate VERSION=0, then VERSION=40. I am wiping all my data in rails. Restart the server. 4) Add UserB with credentials for Google Data to rails db. 5) Get photos for UserB. End up with UserA's data!!

Here is my call:

@google_auth = GoogleUser.new(@user, @pass, 'lh2') # I am including my GoogleUser class below @result_string = @google_auth.make_request('http:// picasaweb.google.com/data/feed/api/user/default?kind=photo&start- index=1&max-results=10') # NOTE: I tried switching default to the actual username of UserB but to no avail.

# here is an example of a photo url for the wrong person: @original_filename = @media_node.get_elements('media:content') [0].attribute('url').value

Is it possible this could be happening? Here is my class. Thanks!

require 'net/http' require 'net/https' require 'uri'

module Net class HTTPS < HTTP def initialize(address, port = nil) super(address, port) self.use_ssl = true end end end

class GoogleUser

#http://code.google.com/support/bin/answer.py?answer=62712&topic=10433 #Calendar data API cl #Blogger data API blogger #Google Base data API gbase #Spreadsheets data API wise #Google Apps Provisioning API apps #Picasa Web Albums Data API lh2 #Documents List Data API writely

GOOGLE_LOGIN_URL = URI.parse('https://www.google.com/accounts/ ClientLogin') attr_accessor :email, :password, :header, :service_type

def make_request(path) http = Net::HTTP.new('picasaweb.google.com', 80) response, data = http.get(path, self.header) data end

def initialize(email, password, service_type) @headers = { } self.email=email self.password=password self.authenticate self.service_type end

def authenticate $VERBOSE = nil # LH2 very important for Picasa response = Net::HTTPS.post_form(GOOGLE_LOGIN_URL, {'Email' => email, 'Passwd' => password, 'service' => service_type, 'source' => 'formula' }) self.header = { 'Authorization' => "GoogleLogin auth=#{response.body.split(/ =/).last}", 'Content-Type' => 'application/atom+xml' } end

public