Questions tagged [tastypie]

Tastypie is a reusable Django App and is suitable for providing an API to any application without having to modify the sources of that app.

Tastypie is a reusable Django App and is suitable for providing a REST API to any application without having to modify the sources of that app.

1634 questions
77
votes
5 answers

How to change status of JsonResponse in Django

My API is returning a JSON object on error but the status code is HTTP 200: response = JsonResponse({'status': 'false', 'message': message}) return response How can I change the response code to indicate an error?
Dhanushka Amarakoon
  • 2,704
  • 5
  • 23
  • 39
49
votes
1 answer

Django : DRF Token based Authentication VS JSON Web Token

I am building a real world application where users will access the app primarily from Android, iOS devices as well as Desktops. From my elementary research, I have realized that token based authentication mechanism is more better and elegant for…
anon
  • 879
  • 1
  • 9
  • 15
37
votes
5 answers

Whats the simplest and safest method to generate a API KEY and SECRET in Python

I need to generate a API key and Secret that would be stored in a Redis server. What would be the best way to generate a key and secret? I am develop a Django-tastypie framework based app.
Dhanushka Amarakoon
  • 2,704
  • 5
  • 23
  • 39
32
votes
6 answers

What Python framework for a REST/JSON web service with no front end?

I need to create a Python REST/JSON web service for an iOS app to interact with. There will be no front end on the web. What will be the fastest, most lightweight framework to use for this? Learning curve to implement also considered? From the…
Rick
  • 461
  • 1
  • 4
  • 5
30
votes
2 answers

Download anchor link with authorization header

I have a link that I would like to add to my javascript (Marionette/Backbone) single page application that will download an Excel file to the user's local drive via the browser's file save. A typical HTTP request would be: GET…
Erik
  • 6,796
  • 7
  • 54
  • 97
30
votes
5 answers

'Request header field Authorization is not allowed' error - Tastypie

I am getting the following error while using ApiKeyAuthentication for my Tastypie resources when I try to do an HTTP request using AJAX and Tastypie: XMLHttpRequest cannot load…
egidra
  • 6,619
  • 16
  • 55
  • 85
28
votes
1 answer

appending multiple querystring variables with curl

I keep getting a 401 response when I try to use authentication = ApiKeyAuthentication() in my ModelResource. I looked at Django Tastypie: How to Authenticate with API Key and he uses the get parameters to solve his issue. If I try use get parameters…
darren
  • 17,033
  • 16
  • 55
  • 79
28
votes
3 answers

Django Tastypie Advanced Filtering: How to do complex lookups with Q objects

I have a basic Django model like: class Business(models.Model): name = models.CharField(max_length=200, unique=True) email = models.EmailField() phone = models.CharField(max_length=40, blank=True, null=True) description =…
nknganda
  • 332
  • 1
  • 3
  • 10
27
votes
2 answers

How to expose a property (virtual field) on a Django Model as a field in a TastyPie ModelResource

I have a property in a Django Model that I'd like to expose via a TastyPie ModelResource. My Model is class UserProfile(models.Model): _genderChoices = ((u"M", u"Male"), (u"F", u"Female")) user = Models.OneToOneField(User, editable=False) …
Danish Munir
  • 607
  • 2
  • 6
  • 15
27
votes
1 answer

Returning data on POST in django-tastypie

I consider it a standard that an object-creating function returns the newly created object. So, any idea how do you do that in tastypie? When I send the POST request, the object is created, I get nothing in response, though. What I would like is to…
mhaligowski
  • 2,080
  • 18
  • 23
25
votes
8 answers

How to use django-debug-toolbar for django-tastypie?

django-debug-toolbar needs its output to be html, but django-tastypie's default output format is json. I tried sending http://localhost/api/v1/resource/?format=html but it says Sorry, not implemented yet. Please append "?format=json" to your URL…
eugene
  • 33,301
  • 47
  • 188
  • 382
24
votes
5 answers

Django-tastypie. Output in JSON to the browser by default

I see 'Sorry, not implemented yet. Please append "?format=json" to your URL.'. I need always append string "?format=json". Can I make a output in JSON by default? Regards, Vitaliy
moskrc
  • 1,198
  • 1
  • 11
  • 22
24
votes
8 answers

How to make sure that my AJAX requests are originating from the same server in Python

I have already asked a question about IP Authentication here: TastyPie Authentication from the same server However, I need something more! An IP address could be very easily spoofed. Scenario: My API (TastyPie) and Client App (in javascript) are…
Prometheus
  • 27,277
  • 37
  • 139
  • 270
24
votes
2 answers

How can I login to django using tastypie

I'm trying to override is_authenticated in my custom authentication. I have something simple (to start with) like this: class MyAuthentication(BasicAuthentication): def __init__(self, *args, **kwargs): super(MyAuthentication,…
imns
  • 4,728
  • 11
  • 51
  • 77
21
votes
3 answers

heroku, postgreSQL, django, comments, tastypie: No operator matches the given name and argument type(s). You might need to add explicit type casts

I have a simple query on django's built in comments model and getting the error below with heroku's postgreSQL database: DatabaseError: operator does not exist: integer = text LINE 1: ... INNER JOIN "django_comments" ON ("pi ns_pin"."id" =…
Arctelix
  • 4,165
  • 2
  • 22
  • 36
1
2 3
99 100