This is a template project for "Modern methods and technologies of software development" course labs. Use it to create
your own repository and fulfill/rewrite this document (at least, replace everything in {...}
).
- { Student's Name and Surname (in English) } { email } — { GitHub account }
- ...
- { Student's Name and Surname (in English) } { email } — { GitHub account }
The [design document]({Place actual link to the design document Google Docs file here, see Laboratory assignment #1}) describes architecture and implementation details of this project.
There are five modules:
url_shortener.auth
authentication module — handles user authentication and access controlurl_shortener.dto
— data transfer objectsurl_shortener.logic
business logic - logic of URL shorteningurl_shortener.storage
— a key-value persistence storage (please, pay attention that you should implement it by yourself. It means that it is not allowed to use data bases, another key-value storages implementation, etc)url_shortener.views
REST API — a module that provides a REST API. Pyramid framework is already added to project dependencies
This is a Python project, so you will need an environment with installed python interpreter of version 3.6 or higher. For installation, you can use the official downloads:
Use PyCharm Edu as IDE
You can use the following tools to work with the REST API
- Open project in PyCharm Edu
- Navigate to
File
->Settings
- Go to
Project: <project name>
->Python Interpreter
- Create virtual environment by clicking Gear button first, then selecting
Add
. ChoseVirtualenv environment
in the new window and chose the interpreter and location for the new virtual environment . PressOK
to create new virtualenv environment. - Open
requirements.txt
file, and then clickInstall requirements
link on the banner - Make sure all checkboxes are selected and click
Install
. Then wait for a while for packages to be installed. - Open
run.py
file, then click on the green triangle at the top of the file. Observe application logs in the console window - Visit http://0.0.0.0:6543/public in your browser and observe
{"available_for": "everyone"}
text
GET
/public
--- public URL which always returns{"available_for": "everyone"}
JSONGET
/resource/{some key}
--- this endpoint is protected. In order to visit it you should passAuthorization: Bearer <some token>
header with your request. Currently authorization is not implemented properly so any token will be valid. If keys is not available,404 Not found
error will be shown to userPUT
/resource/{some key}
, JSON{"value": "some value here"}
--- this endpoint is protected. In order to visit it you should passAuthorization: Bearer <some token>
header with your request. This request will store the valuesome value here
under thesome key
, and saved value will be available for retrieval later using theGET /resource/{some key}
endpoint. Will return409 conflict
if keysome key
is already used.