Requesting request get parameters from PagSeguro

0

I'm trying to integrate a Django app with PagSeguro, but I'm having trouble with the notifications part.

This is the view that receives the notifications:

def recebe_notificacao(request):
    if request.method == 'POST':
        notification_code = request.POST['notificationCode']
        if notification_code:
            url = 'https://ws.pagseguro.uol.com.br/v2/transactions/notifications/' + notification_code + 'email' + 'token'
            r = requests.get(url)
            print 'r ' + r

        else:
            print 'notification code is null'
    return render(request, 'update_transactions.html')

I saw the PagSeguro documentation that they return me several parameters, but I'm not sure how I can access them through the r variable. For example, how do I know the status of the transaction, which is returned as an XML?

    
asked by anonymous 03.06.2014 / 11:59

1 answer

1

Use something like xmltodict to transform XML into a Python object that you can work with.

    
05.06.2014 / 05:56