Dhanushka Amarakoon
Dhanushka Amarakoon

Reputation: 3762

Using REDIS with Tastypie

I need to create a REST API for a user login. Where if successful it should return a Secret value that will be stored in a REDIS server. How would I go about doing this?

Can I do this with the tastypie-redis-resource 0.0.9 ? https://pypi.python.org/pypi/tastypie-redis-resource

If so can you tell me what I need todo.

Upvotes: 2

Views: 85

Answers (1)

Seán Hayes
Seán Hayes

Reputation: 4360

Here's the relevant source: https://github.com/tunix/tastypie-redis-resource/blob/master/tastypie_redis/resources.py

You'll probably want something like:

def obj_create(self, bundle, **kwargs):
    kwargs['secret_field'] = get_new_secret_value()
    return super(MyResource, self).obj_create(bundle, **kwargs)

Upvotes: 2

Related Questions