Skip to content

Repository files navigation

Programming assignment 04

We piloted this assignment last year as an experimental bonus, and many students reporting liking it! If you notice any issues or fixes, then feel free to let me know. A grader who did a lot of real work with REST APIs originally wrote this, and it is well-representative of what you encounter in the wild.

The story:

https://en.wikipedia.org/wiki/Phineas_and_Ferb

"The show follows the adventures of stepbrothers Phineas Flynn and Ferb Fletcher, who are between eight and ten years old. They live in the fictional city of Danville in an unspecified tri-state area, as they seek ways to occupy their time during their "104 days of summer vacation". Often these adventures involve elaborate, life-sized and ostensibly dangerous construction projects, which are usually unrealistic in scale given the protagonists' ages (and sometimes physically impossible). Phineas's older sister Candace has two obsessions: unveiling Phineas and Ferb's schemes and ideas, and winning the attention of a boy named Jeremy."

You (Candace) are trying to expose your brothers, by getting them caught doing their construction projects. To accomplish this seemingly impossible task, you have decided to use a monitoring program developed by Phineas and Ferb themselves. This monitoring program has a built-in REST API that you will use to automate everything. (You are getting very tired of doing it manually yourself). You will use Requests, a Python library for making HTTP requests.

To finish the desired functionality, make changes to: src/client.py

To correctly use the REST API, be sure to reference: docs/api_specification.md

images/candace_with_monitor.png

Python Files

You'll notice some Python files in this repository.

  • src/client.py
    • Write your code here.
    • This is the only file you need to edit.
  • src/payload.py
    • Contains types that represent the format of data returned by the server.
    • You may use the types here to better type-hint your Python code.
  • src/server.py
    • Contains logic for the server.
    • Feel free to peek, to better understand the server, if you would like.
    • DO NOT EDIT.
  • src/text_proxy.py
    • A file that is used by the autograder, to run the server and client code at the same time.
    • DO NOT EDIT.

Manual Testing And Debugging

While developing, we strongly recommend manually running: src/server.py to have the server running while running your code in: src/client.py. To do so, run these commands in two separate terminals as shown:

./src/server.py 
 * Serving Flask app 'Phineas and Ferb Invade The Privacy of Others'
 * Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on http://127.0.0.1:5000
Press CTRL+C to quit

In a separate terminal, run this command to test your code:

./src/client.py http://localhost:5000

Rerun that command each time you want to test your code.

Running: ./src/server.py and ./src/client.py are equivalent to: python3 src/server.py and python3 src/client.py respectively. Optionally, familiarize yourself with: shebangs in scripting.

The debug output (stderr output) of the ./src/server.py command is useful to understand what endpoints are being called. To silence debug output, instead run ./src/server.py 2>/dev/null.

Git autograding

See: docs/git_autograding.md

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages