Tom
unread,Mar 1, 2012, 3:06:56 PM3/1/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to amber-lang
Hi,
I try some asynchronous data fetching using the Picasa API. The
response from Picasa is an atom feed, of which I'd like to pick the
images' urls. So I founded a new class "PicasaQuery", where instances
can be configured to a certain query of images and then fetch the
search result from the Picasa website. Therefor I have a method
"execute", which constructs the request url and does the query. The
query's response is kept in the instance variable "responseXML".
Object subclass: #PicasaQuery
class instanceVariableNames: 'baseURL'
instanceVariableNames: 'query maxResults responseXML'
package: 'TB-PicasaAPI'
execute
"tb: If maxResult is set, then execute the query and answer
the response markup or an empty string."
| uri |
responseXML := ''.
maxResults notNil ifTrue: [
uri := (self class baseURL),'q=',query,'&max-results=',maxResults.
jQuery ajax: uri options: #{
'accept' -> 'application/xml'.
'success' -> [ :data :txtStatus :xhr | responseXML := data ].
'error' -> [window alert: 'Request failed at: ', uri]
}
].
^responseXML
My test query goes like...
response := PicasaQuery new
query: 'Frank+Zappa';
maxResults: 10;
execute.
...where execute returns the response or an empty string. The uri in
this method works fantastic in any web browser, but all that I get
here, is that error alert.
Any suggestions?
Regards...