GithubHelp home page GithubHelp logo

packtpublishing / building-restful-python-web-services Goto Github PK

View Code? Open in Web Editor NEW
117.0 16.0 77.0 224 KB

Code repository for Building RESTful Python Web Services, published by Packt

License: MIT License

Python 45.90% Mako 0.19% HTML 48.37% JavaScript 4.28% CSS 1.26%

building-restful-python-web-services's Issues

Cannot POST w/out header

I've been stuck on this for a few days now:
Pg 68 states that "The following is the equivalent curl command. Note that we don't use the -H option and curl will send the data in the default application/x-www-form-urlencoded:"

But when I
curl -iX POST -d '{"name":"Toy Story 4.2","release_date":"2019-05-18T03:02:00.776594Z","game_category":"3D RPG","played":"false"}' localhost:8000/games/
and when I
curl -iX POST -d '{"name":"Toy Story 4.2","release_date":"2019-05-18T03:02:00.776594Z","game_category":"3D RPG","played":"false"}' -H "Content-Type: application/x-www-form-urlencoded" localhost:8000/games/
I get

HTTP/1.1 400 Bad Request
Date: Sat, 29 Sep 2018 20:51:38 GMT
Server: WSGIServer/0.2 CPython/3.6.5
Content-Type: application/json
Vary: Accept, Cookie
Allow: GET, OPTIONS, POST
X-Frame-Options: SAMEORIGIN
Content-Length: 44

{"release_date":["This field is required."]}

Directory structure is not the same as suggested in the book

There is no games/models.py file or other folders...

django-admin.py startproject gamesapi
(Django01) w@w-MacBook-Pro gamesapi % tree             
.
├── gamesapi
│   ├── __init__.py
│   ├── asgi.py
│   ├── settings.py
│   ├── urls.py
│   └── wsgi.py
└── manage.py

1 directory, 6 files
(Django01) w@w-MacBook-Pro gamesapi % 

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.