Giter VIP home page Giter VIP logo

apis's Introduction

APIs

This is the code Repo for ud388 - Designing RESTful APIs

This code base was meant to supplement the Udacity course for designing RESTful APIs. Within each directory you will find sample and solution code to the exercises in this course. Some of this code will require some modification from the user before it is executable on your machine.

API Keys for third party providers

This course uses the Google Maps and Foursquare APIs. You will need to create developer accounts and private keys in order to properly use code snippets that rely on these APIs.

Python Libraries

The code in this repository assumes the following python libraries are installed:

  • Flask
  • SQLAlchemy
  • httplib
  • requests
  • oauth2client
  • redis
  • passlib
  • itsdangerous
  • flask-httpauth

Installing Redis

  wget http://download.redis.io/redis-stable.tar.gz
  tar xvzf redis-stable.tar.gz
  cd redis-stable
  make install

apis's People

Contributors

13rac1 avatar abefeinberg avatar adarsh0806 avatar baladkb avatar forbiddenvoid avatar gallant-dev avatar globant-gerard-paris avatar jamesyin96 avatar jperera84 avatar karlud avatar lipovetsky avatar lobrown avatar lrnzbr avatar nimitbhargava avatar tdurk93 avatar timbrockman avatar veronikabenkeser 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

apis's Issues

Lesson_2/10_Requesting from Python Code/geocode.py

I am using python 2.7.11 and tried to run the geocode.py script

But i get error... ValueError: No Json object could be decoded in
In this line: result = json.loads(h.request(url,'GET')[1])

Any idea?

Lessson-4-Quiz Mom and BOB Test 1 FAILED: Could not make a new user

When i execute the bagel_test.py to test my view.py one time i get a Test 1 pass, the other times i keep getting
Test 1 FAILED: Could not make a new user

I think this is because the test doesn't check if there is an alreadythe same name has been registerd in the User database, instead it just add the User directly to the Post request.. i could solve this by adding a check to the code

if session.query(User).filter_by(username = "TinnyTim").first() is not None:
u= session.query(User).filter_by(username = "TinnyTim").one()
session.delete(u)
session.commit()

if request.method == 'GET': NameError: global name 'request' is not defined

While executing the FlaskTest2.py file its running on the VM but as soon as the FlaskTestEndPoint.py (end point code) is executed the Name error is thrown which return following error message:

Running Endpoint Tester....
Please enter the address of the server you want to access,
If left blank the connection will be set to 'http://localhost:5000':
Making a GET Request for /puppies...
Test 1 FAILED: Could not make GET Request to web server
('Received an unsuccessful status code of 500',)

File "/Users/sudiptomanna/fullstack/vagrant/PythonData/FlaskTest2.py", line 7, in puppiesFunction
if request.method == 'GET':
NameError: global name 'request' is not defined

Please find the files attached

FlaskTest.txt
FlaskTestEndPoint.txt
Files are transformed into .txt format to upload into GitHub.

Is there anything that needs to be done before executing the files ?

endpoints_project3_solution.py

Test 1 FAILED: Could not make POST Request to web server
("the JSON object must be str, not 'bytes'",)

I am getting this error.
On sending the POST request from postman, it shows the desired result.

why extra query

at /Lesson_4/05_Mom & Pop’s Bagel Shop/Solution/views.py
line 43 why we need to get user.

Lesson 3, endpoints_tester2.py Checks for the wrong Status Code

When testing endpoints2.py with the endpoints_tester2.py code, it would appear that tests 2, 4, and 5 are checking for status 301.

I could imagine two fixes:

  • Either change the status code to 200 for both tests 2, 4, and 5. This would then cause the solution code in endpoints_project2sol.py to pass all tests.
  • Or, change the solution code to return a code of 201 for test 2. This makes sense as test 2 is the makeANewPuppy() test. This would still require a change to endpoints_tester2.py. I am not sure what the status codes for tests 4 and 5 should be.

This issue would be fixed by #9 or #12.

APIs/Lesson_3/06_Adding Features to your Mashup/Solution Code/ "Getting Test Failure when running the tester.py "

I am getting Test Failure when running the tester.py file.

While running tester.py whatever input I give here: –

Please enter the address of the server you want to access,
If left blank the connection will be set to ‘http://localhost:5000’: /restaurants

I am getting:–

Test 1: Creating new Restaurants…
Test 1 FAILED: Could not add new restaurants
(‘Only absolute URIs are allowed. uri = /restaurants/restaurants?location=Buenos+Aires+Argentina&mealType=Sushi’,)

What urls should I try to test it ??

Lessson-4-Quiz Mom and BOB sqlite3.ProgrammingError

i am always having sql thread error when i execute bagel_tester.py or any previouse testers

ProgrammingError: (sqlite3.ProgrammingError) SQLite objects created in a thread can only be used in that same thread.The object was created in thread id 139715948619520 and this is thread id 139715939702528 [SQL: u'SELECT user.id AS user_id, user.username AS user_username, user.password_hash AS user_password_hash \nFROM user \nWHERE user.username = ?\n LIMIT ? OFFSET ?'] [parameters: [{}]] (Background on this error at: http://sqlalche.me/e/f405)

i could solve this issue by adding time.sleep(3) between each try and the other

Lesson_3/06_Adding Features to your Mashup/Solution Code/tester.py does not work

I run the solution code:

  1. I started Lesson_3/06_Adding Features to your Mashup/Solution Code/views.py

in another cmd I tried:
2. Lesson_3/06_Adding Features to your Mashup/Solution Code/tester.py

which leads to the following error message:
SQLite objects created in a thread can only be used in that same thread.The object was created in thread id -1245971648 and this is thread id -1256195264

can you reproduce this? is there a bug in the solution code? what I'm doing wrong?

ProgrammingError: SQLite objects created in a thread can only be used by that same thread

The origin of the error is traced to line 56. Here it is:

sqlalchemy.exc.ProgrammingError: (sqlite3.ProgrammingError) SQLite objects created in a thread can only be used in that
same thread. The object was created in thread id 8628 and this is thread id 5372.
[SQL: SELECT puppy.name AS puppy_name, puppy.id AS puppy_id, puppy.description AS puppy_description
FROM puppy]
[parameters: [immutabledict({})]]

As a newbie, I find this quite cryptic and am unable to completely deduce what caused this.

Thanks,
Reece

no python3 support

With the release of FSND 4.0, we were promised python3-support in al code.

Lesson 3, Part 6

The views.py Starter Code version has all of the routes and methods already implemented. From the video, it would seem that this should be left to the reader to implement.

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.