{"id":22170884,"url":"https://github.com/elhanarinc/socialnetwork-challenge","last_synced_at":"2026-05-09T10:40:35.595Z","repository":{"id":42680822,"uuid":"165875932","full_name":"elhanarinc/socialnetwork-challenge","owner":"elhanarinc","description":"Challenge written with Django Framework","archived":false,"fork":false,"pushed_at":"2022-03-28T19:29:05.000Z","size":35,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-29T22:27:38.493Z","etag":null,"topics":["django","pip","postgresql","python3","virtualenv"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elhanarinc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-15T15:32:12.000Z","updated_at":"2022-03-28T19:29:06.000Z","dependencies_parsed_at":"2022-09-21T23:13:18.751Z","dependency_job_id":null,"html_url":"https://github.com/elhanarinc/socialnetwork-challenge","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elhanarinc%2Fsocialnetwork-challenge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elhanarinc%2Fsocialnetwork-challenge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elhanarinc%2Fsocialnetwork-challenge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elhanarinc%2Fsocialnetwork-challenge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elhanarinc","download_url":"https://codeload.github.com/elhanarinc/socialnetwork-challenge/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245319869,"owners_count":20596052,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["django","pip","postgresql","python3","virtualenv"],"created_at":"2024-12-02T06:56:31.551Z","updated_at":"2026-05-09T10:40:30.572Z","avatar_url":"https://github.com/elhanarinc.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Django Challenge\n\nCoding challenge written with Django Framework. \n\nThis project assumes you had already installed these tools:\n1. [python v3.6 or higher](https://www.python.org/downloads/release/python-367/)\n2. [pip](https://www.makeuseof.com/tag/install-pip-for-python/)\n3. [postgresql](http://postgresguide.com/setup/install.html)\n\nThird party packages, tools, etc:\n1. [bcrypt](https://pypi.org/project/bcrypt/) for encryption of passwords.\n2. [clearbit](https://pypi.org/project/clearbit/) for getting additional data on emails.\n3. [psycopg2](https://pypi.org/project/psycopg2/) for interacting with postgresql.\n4. [pyhunter](https://github.com/VonStruddle/PyHunter) for check email validity.\n5. [PyJWT](https://pyjwt.readthedocs.io/en/latest/) for authentication.\n\n### API Usage\n\nIn order to use the API, you need a living postgresql instance on your local machine with these properties:\n* name_of_database: **socialnetwork**\n* user: **dummy**\n* password: **123456**\n\nIn order to use django with postgresql, you need to follow this [link](https://www.digitalocean.com/community/tutorials/how-to-use-postgresql-with-your-django-application-on-ubuntu-14-04).\n\nFirst we need to create a `virtualenv` by using below commands:\n* `virtualenv venv -p [python3 location like /usr/local/bin/python3]`\n* `source venv/bin/activate`\n* Go to the project directory like `cd /home/challenge-directory/`\n* `pip install -r requirements.txt`\n\nBelow are the commands that is need for populating the empty postgresql table, then running the API:\n* `python manage.py makemigrations socialnetwork`\n* `python manage.py migrate`\n* `python manage.py runserver`\n\nThere are different endpoints for this API:\n\n1. `/signup`\n    * This endpoint accepts *POST* request.\n    * If user data is not on db it hashes the password, inserts the user data into db and returns a **token**.\n    * Body Params:\n    ```\n    {\n        \"name\": \"dummy\",\n        \"email\": \"dummy@gmail.com\",\n        \"password\": \"123456\"\n    }\n    ```\n\n2. `/login`\n    * This endpoint accepts *POST* request.\n    * If user data is on db, it returns a **token**.\n    * Body Params:\n    ```\n    {\n        \"email\": \"dummy@gmail.com\",\n        \"password\": \"123456\"\n    }\n    ```\n\n3. `/create`\n    * This endpoint accepts *POST* request.\n    * `x-access-token` should be on header.\n    * Body Params:\n    ```\n    {\n        \"content\": \"Lorem ipsum dolor sit amet\"\n    }\n    ```\n\n4. `/like`\n    * This endpoint accepts *POST* request.\n    * `x-access-token` should be on header.\n    * Body Params:\n    ```\n    {\n        \"post_id\": 5\n    }\n    ```\n5. `/unlike`\n    * This endpoint accepts *POST* request.\n    * `x-access-token` should be on header.\n    * Body Params:\n    ```\n    {\n        \"post_id\": 5\n    }\n    ```\n\nAdditional Information:\n* There are also 7 different endpoints other than the endpoints above and used for helper endpoints of automated bot and debugging.\n* You could find a sample **POSTMAN** json file in the directory.\n\n### AUTOMATED BOT\nFor this part, again you need to activate virtualenv and install requirements.\n\nBot Configuration File:\n```\n{\n  \"number_of_users\": 4,\n  \"max_posts_per_user\": 4,\n  \"max_likes_per_user\": 4,\n  \"api_url\": \"http://localhost:8000\"\n}\n\n```\nSample bot start command (You should give the bot config location as --file parameter):\n* `python automated_bot.py --file config.json`\n\nTools used for deploying and serving endpoints:\n1. [Microsoft Azure VM](https://azure.microsoft.com/tr-tr/services/virtual-machines/)\n2. [gunicorn](https://gunicorn.org/)\n3. [nginx](https://www.nginx.com/)\n4. [supervisor](http://supervisord.org/introduction.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felhanarinc%2Fsocialnetwork-challenge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felhanarinc%2Fsocialnetwork-challenge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felhanarinc%2Fsocialnetwork-challenge/lists"}