This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Designed to take the heavy lifting out of working with django-tastypie APIs on the client side.

Features

  • Django model-like ORM API allowing you to GET, POST, PUT, PATCH, and DELETE:

    factory = ResourceFactory('http://localhost:8000/myapp/api/v1/')
    current_resource = factory.resource.get(field='name')    # GET
    new_resource = factory.resource(field='new_name').save() # POST
    new_resource.field = 'different_name'
    new_resource.save()                                      # PUT / PATCH
    current_resource.delete()                                # DELETE
    
  • Easily work with any related resources:

    new_resource.children = [
        factory.resource(field='new_name1').save(),
        factory.resource(field='new_name2').save(),
    ]
    
  • QuerySets:

    queryset1 = factory.resource.filter(field2__gt=20)
    queryset2 = queryset1.order_by('field2')
    # Evaluation happens here:
    resources = queryset2[5:-8]
    
  • Simple way to set and update authentication per resource:

    factory.resource.auth = HTTPApiKeyAuth('username', 'key12345')
    
  • Access nested resources using simple methods:

    new_resource.nested.nested_resource('arg1', arg2=3)
    
  • Basic field validation before connecting to the API.

  • Bulk create / update / delete to minimise API access:

    factory.resource.bulk(
        create=[{field='name1'}, {field='name2'}],
        update=[current_resource, new_resource],
        delete=[new_resource],
    )
    

Find more information on these features at read the docs!

Requirements

The following needs to be installed locally to run TastyTopping:

  • Python 2.7+ or Python 3.3+
  • requests >= 1.2.3

Tested with / against:

(see the tox.ini file for more information).

Example

A basic example of a simple workflow, using the following API on the server side:

# myapp/models.py
# ===============
from django.db import models

class Example(models.Model):
    path   = models.CharField(max_length=255, unique=True)
    rating = models.IntegerField(default=50)
    date   = models.DateTimeField('date', null=True)


# myapp/api.py
# ============
from .models import Example

class ExampleResource(ModelResource):
    class Meta:
        queryset = Example.objects.all()
        resource_name = 'example'
        authorization = Authorization()
        filtering = {'path': ALL, 'rating': ALL}
        ordering = ['rating']

Using TastyTopping on the client side would look like this:

from datetime import datetime
from tastytopping import ResourceFactory

factory = ResourceFactory('http://localhost:8000/myapp/api/v1/')
ex1 = factory.example(path='any text', rating=80).save()
ex1.date = datetime.now()
ex1_copy = factory.example.get(rating=80)
ex1.delete()

Find more examples at read the docs!

Justification

Why another one? There are some other packages around that do something similar, but none are the complete package:

  • ORM. A lot of other packages use a C-style API, which involves passing a dict with your data to their functions. TastyTopping wraps it all up in an ORM-style object, which is more OO, more elegant, and more pythonic.
  • Python3 support.
  • Support for authentication.
  • Support for nested resources.
  • QuerySets!
  • A thorough set of unit tests.
  • Development has stagnated (none of them have released in close to a year, whereas tastypie has been releasing thick and fast).
  • Creating this was FUN!
Release History

Release History

1.2.5

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.2.4

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.2.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.2.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.2.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.2.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.1.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.1.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.1.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.8

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.7

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.6

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.5

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
TastyTopping-1.2.5-py2.py3-none-any.whl (32.2 kB) Copy SHA256 Checksum SHA256 any Wheel Aug 10, 2015
TastyTopping-1.2.5.tar.gz (36.6 kB) Copy SHA256 Checksum SHA256 Source Aug 10, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting