Posts

Backends Video – Google App Engine Software Platform

Here is an interesting video about the new google ‘backend’ concept on the google app engine cloud computing platform.

 

Google says that these new backend instances will allow GAE software developers to perform more heavyweight computation tasks on the Google Cloud – something that up to now has been very difficult (sometimes impossible) to achieve. We have been struggling to overcome quite a few of these issues on the GAE and are very hopefully that this new functionality will save us a lot of software development time that we would otherise have spent coding around them.

 

Anyway the video is well worth a watch if you have the time:

 

http://geektv.info/video/search-engine-tips-e-tricks/google-io-2011-app-engine-backends/

 

Once again its great to see the google software developers dealing with these issues and coming up with solutions – keep up the good work lads!

Google Cloud Software Release – App Engine 1.5

To coincide with Google I/O, Google has released the latest version of their cloud computing platform – Google App Engine 1.5.0, more details can be found here.

 

There seem to be quite a few interesting additions and changes to the platform especially for those software developers that are involved in doing more heavyweight computing on the backend – we fall into this category and we look froward to trying out the new features!

 

We have been hitting hard memory limits when parsing relatively medium sized XML files (>700Mib) with the DOM parser – hopefully this problem will disappear with the GAE’s new ‘backend’ framework. Will test & report back!

New Version of Google App Engine Relased

Google has released a new version its App Engine Software platform, the register writes about it here.

 

Of great interest to us is that the Blob Store API has been upgraded allow programmers to fully interact with blobs, previously data could only be written to a blob in the blobstore via a HTTP post, but now it seems data can be written to a blob, at will, directly from code – i.e. The blobstore API was more or less useless and now it should be useful! ;-)

 

Previously we had to design and implement our own BLOB storage mechanism on top of the Google Datastore to get around these limitations, so hopefully now such homegrown efforts will be no longer required….

 

Also a new unit test framwork for python has been added, we already happily use the GAE Unit framework on which it seems the new google framework is partly based.

 

It is great to see google push ahead and continue to support software developers by fixing up and improving their platform – keep up the good work lads; a lot done, a lot more to do!

Google App Engine & Paypal Talk Slides

I very much enjoyed the GTUG Dublin meeting last night at Google HQ in Dublin. There were very interesting speakers and a nice pint was had afterwards in the schoolhouse! It was nice to meet everybody and have a good chin-wag.

 

I have uploaded the slides to my talk on integrating paypal and the google app engine, they can be downloaded from here.

Google App Engine & Paypal Talk

Hi, just a note to let you know that I will be giving a talk at the next Dublin Google Technology User Group (GTUG) meeting on how to go about hooking up Paypal payments to the Google App Engine (GAE). The meeting will be held next Tuesday the 28th at 6:30pm.

 

So if you feel up to being bored to within an inch of your life by some gory GAE & Paypal details then you now know where to go!

 

More details can be found on the Dublin GTUG page here:

 

http://groups.google.com/group/dublin-gtug

 

I have uploaded the slides to my talk on integrating paypal and the google app engine, they can be downloaded from here

 

 

Kevin.

Google App Engine – Paypal PDT Example

We have been slaving away in the cloud working on integrating paypal with a google app engine application for one our clients in Dublin. There really isn’t much information ‘out there’ on the subject of connecting to paypal from the GAE, so I have decided to write up some notes in the hope that they prove useful to others (and me when I forget all about it!)

 

I am going to start at the ‘end’ while the information is fresh in my head, when using ‘Paypal Payments Standard’ you can choose to get Paypal to pass you back transaction outcome information when it redirects back to your website after a transaction – they call this PDT. You can use this information to update the transaction/order status on your website (once you verify it).

 

Here is some more information on PDT:

 

https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/howto_html_paymentdatatransfer

 

With PDT enabled paypal adds some arguments to the return url, these arguments contain information about the transaction, however you shouldn’t really trust this info as the HTTP POST could have been spoofed by somebody else. So to check the transaction information you pull out the ‘tx’ argument and pass it back to paypal which will return a verification message that contains the transaction details.

 

So to verify a PDT transaction we must:

 

(a) Get the ‘txt’ argument from the paypal return request.
(b) Perform a HTTP POST back to paypal specifying ‘tx’
(c) Check the response from Paypal, check for ‘SUCCESS’, check ‘payment_status’ and possibly other transaction details.

 

In Python on the Google App Engine the python code could look like this:

 

[code lang=”python”]
import urllib
from google.appengine.api import urlfetch
import re
#
class paypal_pdt_handler(RequestHandler):
def get(self):
# Get the transaction id, tx=blahblahblah
trans_id = self.request.get(‘tx’)

# Confgure POST args
args = {}
# Specify the paypal command
args[‘cmd’] =’_notify-synch’
args[‘tx’] = trans_id
args[‘at’] = _identity_token

args = urllib.urlencode(args)

try:
# Do a post back to validate
# the transaction data
status = urlfetch.fetch(url = _paypal_url,
method = urlfetch.POST,
payload = args).content
except:
self.response.out.write(‘POST Failed’)

# Check for SUCCESS at the start of the response
if re.search(‘^SUCCESS’, status):
# Check other transaction details here like
# payment_status etc..
# Update order status
self.response.out.write(‘OK’)
else:
self.response.out.write(‘Failed’)
[/code]

 

This is a slightly cut down example, in a real application you would need to do a bit more error handling etc. In this example the following variables need to be given values:

 

_paypal_url – The url to paypal, either sandbox or live.
_identity_token – Your “Identity Token”, see this post for info on how to find this in your paypal account:

 

NOTE: Another way to get information on transaction status is to handle Paypal IPN. I tend to use both methods as if you only use PDT and for some reason the user does not redirect back to your site, then your site won’t b able to check the transaction status whereas IPN messages will be delivered in all cases.

XML-RPC calls from Google App Engine Client

There are some interesting aspects to doing Software Enginering from within the Google App Engine sandbox – I came across this interesting article on how to play with things so that you can make XML-RPC calls from within the google app engine sandbox.  By default such calls will be blocked but the article shows who to provide your own ‘Transport’ object to break out of the sandbox.


http://brizzled.clapper.org/id/80


I haven’t tried the technique yet as there are a few changes to make but I hope to try it soon and report back!

In the mean time if anybody has tried the technique please let us know how you got on!