Contents Menu Expand
cs61a-apps
cs61a-apps

Meta

  • Contributors
  • License
  • GitHub Repository

Utilities

  • common
    • common.rpc
  • hog-calc
  • logs
  • partnermatcher
  • paste
  • secrets

Apps

  • 61A Autograder
  • 61A Documentation
  • Domains Tool
  • Hog Contest
  • Hosted Apps DNA
  • Howamidoing
  • Shortlinks

Shortlinks¶

Handler for go.cs61a.org and links.cs61a.org shortlinks.

Local Development¶

Create and activate a venv:

$ python3 -m venv env
$ source env/bin/activate

Use pip to install all the dependencies:

$ pip install -r requirements.txt

Run the server:

$ python main.py

Code Documentation¶

class shortlinks.main.AccessRestriction(value)[source]¶

Enumeration of access restrictions: all (0), staff (1), student (2).

shortlinks.main.add_url_params(url, params_string)[source]¶

Takes in a URL and a string of parameters, and adds the parameters to the URL.

Parameters
  • url (str) – URL to add parameters to

  • params_string (str) – string of parameters to add

Returns

URL with parameters string added

shortlinks.main.lookup(path)[source]¶

Looks up a path in the database.

Parameters

path – path to look up

Returns

result of lookup, or (None, None, None) upon failure.

shortlinks.main.is_authorized(secure: shortlinks.main.AccessRestriction)[source]¶

Returns authorization status based on the given access restriction.

Parameters

secure (AccessRestriction) – access restriction

Returns

authorization status (True or False)

Previous
Howamidoing
Copyright © 2021 CS 61A | Built with Sphinx and @pradyunsg's Furo theme. | Show Source
Contents
  • Shortlinks
    • Local Development
    • Code Documentation