Python version: 3.7.7
-
Clone project from repository, make and activate new virtual environment;
-
Install requirements:
pip install -r requirements.txt
-
Make socialnetwork/socialnetwork/settings.py file with the following content:
from socialnetwork.base_settings import * SECRET_KEY = '' # your-secret-key DEBUG = True # desired debug setting ALLOWED_HOSTS = [] # allowed hosts
-
Migrate everything and run server.
The service is a simple social network which provides the following functionality:
- Registering (auth/users/) - need to send username and password in POST request;
- Viewing users (auth/users/) - GET request from authorized user will give user info for common and list of all users for admin user. GET request to auth/users/me will give info about current user;
- Authorization (auth/jwt/create/) - need to send username and password in POST request;
- Token verification (auth/jwt/verify/) - need to send current access token in POST request;
- Token refresh (auth/jwt/refresh/) - need to send refresh token in POST request to get new access token;
- Making a post (api/posts/) - need to send content in POST request as well as authorization header with value Bearer Token;
- Viewing posts (api/posts/) - need to be authorized and send GET request to get the list of all posts;
- Making like (api/likes/) - need to send post id in POST request to like the specified post;
- Removing like (api/likes/post_id) - need to send DELETE request with the specified post in URL to remove like;
- Gathering analytics (api/analytics/) - need to put desired dates in query string (e.g. analytics/?date_from=2020-05-07) and send GET request to get analytics about how many likes was made during the specified period.
- Password changing/etc - provided by djoser
Bot can do the following:
- Create and authorize random user as well as refresh authorization token;
- Create random post;
- Like post;
- Unlike post;
- Make request to gather analytics;
- Simulate activity in the service by making specified amount of users, posts, likes and gathering analytics after simulation.
If bot.py was called as script bot will simulate activity and show analytics after.