Skip to content

Latest commit

 

History

History
47 lines (37 loc) · 2.11 KB

File metadata and controls

47 lines (37 loc) · 2.11 KB

python

Just me exploring Python while learning more in my grad school course - BCIS 5390: Python Programming

IDE and Textbook information

FYI - Python offers a free IDLE that is perfect for beginners!

My personal favorite is PyCharm which is offered by JetBrains!

For my graduate school course, I am renting a digital version of this textbook:

How do I run these programs?

  • Run these programs using your terminal or command line tool.
  • Type python name_of_program.py
    • For example, python print_favorite_things.py

What about unit tests?

  • I explored a simple example for the Greeting class
  • Using TestCase from unittest, right click on test_greeting.py and run unit tests.

Bonus 1: files in the database directory

  • I explored an elementary example of connecting to a built in database called SqLite
  • database.py creates the database, tables, and inserts data
  • super_hero_info.py accepts user input and returns super hero information from this database.

Bonus 2: files in the rest_api directory

Running the API and testing it

  • Prerequisite - make sure Flask is installed

  • switch to the rest_api directory

  • in a terminal, run the following commands:

    • set FLASK=development
    • set FLASK_APP=app.py
  • run the flask run command

  • Invoke the API using your favorite API testing tool (OR, in the browser!).

    • I prefer Postman
    • GET all users - http://127.0.0.1:5000/users/
    • GET one user - http://127.0.0.1:5000/users/<id>