Code Monkey home page Code Monkey logo

eve-demo's People

Contributors

lowellbander avatar nicolaiarocci avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

eve-demo's Issues

eve-demo requests are very very slow

Ran installing eve

$ pip install eve

Started Server

$ python run.py

When accessing the REST api's the response is very very slow,

Environment details:

OS: Windows

Python: Python 3.6.3 :: Anaconda, Inc.

Live demo 500 error

I've managed to break something I believe.

The live demo is returning a 500 on GET requests.

Example responses in the README are out of date

For example, the README suggests that you can POST an array of objects to a collection endpoint, and you'll get back an array of result objects. The actual Eve demo behaves as described in the documentation on the Eve "Features" page: it returns an object with an _items key that contains the array of result objects.

Updating the documentation in the README to match the master docs would be good, but tedious - a better idea might just be to link to the master docs on http://python-eve.org/

Requests don't seem to be able to send dictionaries to eve

Hi,
I'm trying to use your demo example with the requests library. It does work fine when sending just the firstname and lastname. But not when sending the location dictionary.

payload = {'firstname': 'lapin', 
           'lastname': 'lauvages3',
           'location': {'address': 'blabla', 'city': 'Paris'}}
r = requests.post('http://127.0.0.1:5000/people', data=payload)
print r.text
print r.url
{"_status": "ERR", "_issues": {"location": "must be of dict type"}, "_error": {"message": "Insertion failure: 1 document(s) contain(s) error(s)", "code": 422}}
http://127.0.0.1:5000/people

But it work fine with curl. I guess I'm missing something in the request code, but I really can't figure it out.

curl -d '{"firstname": "lapin", "lastname": "lauvage3", "location": {"address": "blabla", "city": "Paris"}}'  -H 'Content-Type: application/json'   http://127.0.0.1:5000/people
{"_updated": "Tue, 14 Apr 2015 08:14:01 GMT", "_links": {"self": {"href": "people/552ccc49bd84780289f8a607", "title": "person"}}, "_created": "Tue, 14 Apr 2015 08:14:01 GMT", "_status": "OK", "_id": "552ccc49bd84780289f8a607", "_etag": "88fe38b3d03967b1746c65a37acfb35531f87088"}

Do you have any idea what I'm doing wrong?
Thanks!

Malformed XML render when href includes forbidden URI/URL chars

Specifically, when you do a ?where={...} query with page=n and accept:text/xml request header, when n is greater than the results, you get a link to the previous page including the "?where" query, unquoted. In that case, you get an XML parsing exception due to the link href including literal {.

#!/usr/bin env python
import requests
from xml.dom.minidom import parseString

headers = {'accept': 'text/xml'}
bad_link = 'http://eve-demo.herokuapp.com/people/' \
           '?where={"lastname":"Doe"}&page=2'

# xml.parsers.expat.ExpatError: not well-formed (invalid token)
parseString(requests.get(bad_link, headers=headers).text)

Instead of xml.sax.saxutils.escape, you probably want urllib.quote to quote the hrefs.

Add example of dates and date_format property to settings.py

It would be very helpful to see an example of how to work with dates in general and date_format in particular in this demo, as these are very common use cases. The documentation only briefly touches the subject of date_format, and provides no examples.

403 Forbidden on DELETE item

Hello nicolaiarocci,

First off, thank you and everyone who contributes to Eve; it looks like a fantastic project to really streamline creating rest api's in python.

But, in trying things out, I've run into a problem. After cloning the repository and starting the development server, I am unable to DELETE single items. For example (with MongoDB setup in a docker container and pip3 install eve in a virtualenv (python version 3.4)):

$ curl -X GET -H 'Content-Type: application/json' localhost:5000/people
{
    "_items":  [], 
    "_links": {
        "parent": {
            "title": "home", 
            "href": ""
        }, 
        "self": {
            "title": "people", 
            "href": "/people"}
        }
}
$ curl -X POST -d '{"firstname": "test", "lastname": "test", "role": ["contributor"]}' localhost:5000/people
{
  "_updated": "Fri, 05 Sep 2014 18:01:44 GMT",
  "_id": "5409fa883a347127db3e82c2",
  "_created": "Fri, 05 Sep 2014 18:01:44 GMT",
  "_links": {
    "self": {
      "title": "person",
      "href": "/people/5409fa883a347127db3e82c2"
    }
  },
  "_status": "OK",
  "_etag": "54fa4ca775664d6f0e095aeba187cc3a6f14c78c"
}
$ curl -X DELETE localhost:5000/people/5409fa883a347127db3e82c2
{
  "_error": {
    "message": "You don't have the permission to access the requested resource. It is either read-protected or not readable by the server.",
    "code": 403
  },
  "_status": "ERR"
}
$ # ^^^ This should have worked
$ curl -X PATCH -d '{"firstname": "test_changed"}' localhost:5000/people
{
  "_error": {
    "message": "You don't have the permission to access the requested resource. It is either read-protected or not readable by the server.",
    "code": 403
  },
  "_status": "ERR"
}
$ # ^^^ This also does not work
$ curl -X DELETE localhost:5000/people
{}
$ # ^^^ But, this does work

I've logged into my MongoDB instance and checked that the person is actually being stored. And, I've tried adding all methods to PUBLIC_METHODS and PUBLIC_ITEM_METHODS and even to individual resources' resource_methods, item_methods, public_methods, public_item_methods methods lists.

I am having this same problem on my own testing of eve. So, assuming everything would be configured correctly in this repo, I thought I would clone the demo to check if it is just my settings that were misconfigured. But, it looks like the problem exists here as well. Is there something I've missed?

Using PUT/PATCH/DELETE on Live Demo

Unable to use any of these methods at the live demo, despite the global methods being defined.

curl -i -v -X PATCH -d '{"firstname": "Raymond"}' -H 'Content-Type: application/json' http://eve-demo.herokuapp.com/people/53e86164503a690002740c3a
or
curl -i -v -X DELETE http://eve-demo.herokuapp.com/people/53e86164503a690002740c3a

I tried this on my own setup after going through the demo and got the same result. GET/POST works, nothing else does. If any of this is expected behavior, I think the quickstart needs some updating, the test for DELETE at the end of the A Minimal Application gives makes me think that the RESOURCE_METHODS including DELETE would allow this operation, but it still fails as well.

Furthermore, why am I getting 403's for a resource that doesn't exist? I would expect a 404.

curl -i -v -X PATCH -d '{"firstname": "Raymond"}' -H 'Content-Type: application/json' http://eve-demo.herokuapp.com/people/junkdata

404 page does not honor Accept header

As I understand, if client accepts "application/json", NotFound error must be presented as JSON. But server returns HTML. See console output:

curl -H "Accept: application/json" -i http://eve-demo.herokuapp.com/not-a-collection
HTTP/1.1 404 NOT FOUND
Content-Type: text/html
Date: Mon, 11 Nov 2013 15:24:23 GMT
Server: Eve/0.2-dev Werkzeug/0.9.4 Python/2.7.4
Content-Length: 233
Connection: keep-alive

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>404 Not Found</title>
<h1>Not Found</h1>
<p>The requested URL was not found on the server.  If you entered the URL manually please check your spelling and try again.</p>

Heroku deployment

Hi,

Thank you for initiating this project.

I tried to download this eve-demo project, and I was able to run it fine using python run.py command. But it behaves weird when I run it using foreman start (this is from https://devcenter.heroku.com/articles/getting-started-with-python#procfile). All the possible links return a 404 Not Found error.

This problem also happens when we do deployment on Heroku. I thought it was a problem on the mongodb connection. So I made sure that the mongodb info on the settings.py is correct, but it doesn't fix the 404.

May I know how you deploy to heroku? Do you do foreman start when running locally?

Updated examples to latest version Eve

Hello, Nicola.

Will be nice to update examples to latest version ๐Ÿ‘

Because:

Note. The demo is currently running v0.0.4 of the Eve framework. Eve-Demo is only updated when major Eve updates are released. Please refer to the official Eve repository for an up-to-date features list.

Adding multiple items to the people collection errors

Trying to get to grips with eve by using eve-demo and I've run into an issue with adding multiple items.

~/dev
$ curl -d 'item1={"firstname": "bill", "lastname": "clinton"}' -d 'item2={"firstname": "mitt", "lastname": "romney"}' http://127.0.0.1:5000/people

results in

{"_status": "ERR", "_issues": {"item2": "unknown field", "lastname": "required field", "item1": "unknown field"}}

Malfunctions when run with Foreman or when PORT environment variable exists

Running eve-demo with python run.py works as expected on my local development system. When I run it using foreman start the app starts, listents on port 5000, but requests fail with 404 errors. No additional diagnostic information is provided.

eve-demo assumes that if the PORT environment variable is present, it's running the live demo on http://eve-demo.herokuapp.com and will try to connect to the live Mongo DB at mongohq.com. Subsequent resource requests fail with a 404 error as a result.

It would be helpful if eve-demo wrote diagnostic info to the console at initialization or when requests fail. Might save someone (me?) a bit of head-scratching.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.