├── Django └── dataExtractor │ ├── db.sqlite3 │ ├── github │ ├── __init__.py │ ├── migrations │ │ ├── __init__.py │ │ ├── __pycache__ │ │ │ ├── __init__.cpython-39.pyc │ │ │ ├── 0001_initial.cpython-39.pyc │ │ │ └── 0002_rename_blog_githubuser_websiteurl_and_more.cpython-39.pyc │ │ ├── 0001_initial.py │ │ └── 0002_rename_blog_githubuser_websiteurl_and_more.py │ ├── templates │ │ ├── extractData.css │ │ ├── main.html │ │ ├── extractedData.html │ │ └── extractData.html │ ├── tests.py │ ├── admin.py │ ├── __pycache__ │ │ ├── admin.cpython-39.pyc │ │ ├── apps.cpython-39.pyc │ │ ├── models.cpython-39.pyc │ │ ├── urls.cpython-39.pyc │ │ ├── views.cpython-39.pyc │ │ └── __init__.cpython-39.pyc │ ├── apps.py │ ├── urls.py │ ├── models.py │ └── views.py │ ├── dataExtractor │ ├── __init__.py │ ├── __pycache__ │ │ ├── urls.cpython-39.pyc │ │ ├── wsgi.cpython-39.pyc │ │ ├── __init__.cpython-39.pyc │ │ └── settings.cpython-39.pyc │ ├── asgi.py │ ├── wsgi.py │ ├── urls.py │ └── settings.py │ └── manage.py ├── SQL └── dataExtractionDatabase.sql └── README.md /Django/dataExtractor/db.sqlite3: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Django/dataExtractor/github/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Django/dataExtractor/dataExtractor/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Django/dataExtractor/github/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Django/dataExtractor/github/templates/extractData.css: -------------------------------------------------------------------------------- 1 | .searchBoxDiv 2 | { 3 | width: 80%; 4 | } -------------------------------------------------------------------------------- /Django/dataExtractor/github/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /Django/dataExtractor/github/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | 3 | # Register your models here. 4 | -------------------------------------------------------------------------------- /SQL/dataExtractionDatabase.sql: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andresrodriguez55/githubUsersDataScraper/HEAD/SQL/dataExtractionDatabase.sql -------------------------------------------------------------------------------- /Django/dataExtractor/github/__pycache__/admin.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andresrodriguez55/githubUsersDataScraper/HEAD/Django/dataExtractor/github/__pycache__/admin.cpython-39.pyc -------------------------------------------------------------------------------- /Django/dataExtractor/github/__pycache__/apps.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andresrodriguez55/githubUsersDataScraper/HEAD/Django/dataExtractor/github/__pycache__/apps.cpython-39.pyc -------------------------------------------------------------------------------- /Django/dataExtractor/github/__pycache__/models.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andresrodriguez55/githubUsersDataScraper/HEAD/Django/dataExtractor/github/__pycache__/models.cpython-39.pyc -------------------------------------------------------------------------------- /Django/dataExtractor/github/__pycache__/urls.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andresrodriguez55/githubUsersDataScraper/HEAD/Django/dataExtractor/github/__pycache__/urls.cpython-39.pyc -------------------------------------------------------------------------------- /Django/dataExtractor/github/__pycache__/views.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andresrodriguez55/githubUsersDataScraper/HEAD/Django/dataExtractor/github/__pycache__/views.cpython-39.pyc -------------------------------------------------------------------------------- /Django/dataExtractor/github/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andresrodriguez55/githubUsersDataScraper/HEAD/Django/dataExtractor/github/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /Django/dataExtractor/dataExtractor/__pycache__/urls.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andresrodriguez55/githubUsersDataScraper/HEAD/Django/dataExtractor/dataExtractor/__pycache__/urls.cpython-39.pyc -------------------------------------------------------------------------------- /Django/dataExtractor/dataExtractor/__pycache__/wsgi.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andresrodriguez55/githubUsersDataScraper/HEAD/Django/dataExtractor/dataExtractor/__pycache__/wsgi.cpython-39.pyc -------------------------------------------------------------------------------- /Django/dataExtractor/github/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class GithubConfig(AppConfig): 5 | default_auto_field = 'django.db.models.BigAutoField' 6 | name = 'github' 7 | -------------------------------------------------------------------------------- /Django/dataExtractor/dataExtractor/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andresrodriguez55/githubUsersDataScraper/HEAD/Django/dataExtractor/dataExtractor/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /Django/dataExtractor/dataExtractor/__pycache__/settings.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andresrodriguez55/githubUsersDataScraper/HEAD/Django/dataExtractor/dataExtractor/__pycache__/settings.cpython-39.pyc -------------------------------------------------------------------------------- /Django/dataExtractor/github/migrations/__pycache__/__init__.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andresrodriguez55/githubUsersDataScraper/HEAD/Django/dataExtractor/github/migrations/__pycache__/__init__.cpython-39.pyc -------------------------------------------------------------------------------- /Django/dataExtractor/github/migrations/__pycache__/0001_initial.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andresrodriguez55/githubUsersDataScraper/HEAD/Django/dataExtractor/github/migrations/__pycache__/0001_initial.cpython-39.pyc -------------------------------------------------------------------------------- /Django/dataExtractor/github/migrations/__pycache__/0002_rename_blog_githubuser_websiteurl_and_more.cpython-39.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/andresrodriguez55/githubUsersDataScraper/HEAD/Django/dataExtractor/github/migrations/__pycache__/0002_rename_blog_githubuser_websiteurl_and_more.cpython-39.pyc -------------------------------------------------------------------------------- /Django/dataExtractor/github/urls.py: -------------------------------------------------------------------------------- 1 | from unicodedata import name 2 | from django.urls import path 3 | from . import views 4 | 5 | urlpatterns = [ 6 | path('', views.main), 7 | path('extractData', views.extractData), 8 | path('saveData', views.createGithubUser, name = 'saveData'), 9 | path('extractedData', views.extractedData), 10 | ] 11 | -------------------------------------------------------------------------------- /Django/dataExtractor/github/templates/main.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |

Extract Data

11 |

Extracted Data

12 | -------------------------------------------------------------------------------- /Django/dataExtractor/dataExtractor/asgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | ASGI config for dataExtractor project. 3 | 4 | It exposes the ASGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/4.0/howto/deployment/asgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.asgi import get_asgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'dataExtractor.settings') 15 | 16 | application = get_asgi_application() 17 | -------------------------------------------------------------------------------- /Django/dataExtractor/dataExtractor/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for dataExtractor project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/4.0/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'dataExtractor.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Github Users Data Scraper 2 | 3 | ## Goal 4 | 5 | Build a Django based web app that helps us make automated searches from GitHub mainly and extract information, in other words, a candidate's relevant information, then stores this information in a PostgreSQL database, using vanilla HTML and javascript and bootstrap CSS on the frontend and display results in simple web interfaces. 6 | 7 | ## Success Metric(s): 8 | 9 | Retrieve every relevant information that is important for a recruiter 10 | 11 | ## Solution 12 | 13 | To obtain the specific data of each user, graphql is used. 14 | 15 | ## Demo 16 | https://user-images.githubusercontent.com/57767201/159126629-474ca074-f1ab-4b1b-b513-ab9f5cbafefc.mp4 17 | -------------------------------------------------------------------------------- /Django/dataExtractor/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | """Django's command-line utility for administrative tasks.""" 3 | import os 4 | import sys 5 | 6 | 7 | def main(): 8 | """Run administrative tasks.""" 9 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'dataExtractor.settings') 10 | try: 11 | from django.core.management import execute_from_command_line 12 | except ImportError as exc: 13 | raise ImportError( 14 | "Couldn't import Django. Are you sure it's installed and " 15 | "available on your PYTHONPATH environment variable? Did you " 16 | "forget to activate a virtual environment?" 17 | ) from exc 18 | execute_from_command_line(sys.argv) 19 | 20 | 21 | if __name__ == '__main__': 22 | main() 23 | -------------------------------------------------------------------------------- /Django/dataExtractor/dataExtractor/urls.py: -------------------------------------------------------------------------------- 1 | """dataExtractor URL Configuration 2 | 3 | The `urlpatterns` list routes URLs to views. For more information please see: 4 | https://docs.djangoproject.com/en/4.0/topics/http/urls/ 5 | Examples: 6 | Function views 7 | 1. Add an import: from my_app import views 8 | 2. Add a URL to urlpatterns: path('', views.home, name='home') 9 | Class-based views 10 | 1. Add an import: from other_app.views import Home 11 | 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 12 | Including another URLconf 13 | 1. Import the include() function: from django.urls import include, path 14 | 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) 15 | """ 16 | from django.contrib import admin 17 | from django.urls import path, include 18 | 19 | urlpatterns = [ 20 | path('admin/', admin.site.urls), 21 | path('', include('github.urls')) 22 | ] 23 | -------------------------------------------------------------------------------- /Django/dataExtractor/github/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | #https://github.com/dead-claudia/github-limits 4 | class GithubUser(models.Model): 5 | username = models.CharField(max_length=39, primary_key=True) 6 | name = models.CharField(max_length=255, null=True) 7 | email = models.CharField(max_length=255, null=True) 8 | websiteURL = models.CharField(max_length=255, null=True) 9 | location = models.CharField(max_length=255, null=True) 10 | company = models.CharField(max_length=255, null=True) 11 | bio = models.CharField(max_length=160, null=True) 12 | profilePictureURL = models.CharField(max_length=255, null=True) 13 | followersCount = models.IntegerField(default=0) 14 | repositoriesCount = models.IntegerField(default=0) 15 | forksObtained = models.IntegerField(default=0) 16 | starsObtained = models.IntegerField(default=0) 17 | languageMostUsed = models.CharField(max_length=100, null=True) -------------------------------------------------------------------------------- /Django/dataExtractor/github/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.2 on 2022-03-14 08:54 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | initial = True 9 | 10 | dependencies = [ 11 | ] 12 | 13 | operations = [ 14 | migrations.CreateModel( 15 | name='GithubUser', 16 | fields=[ 17 | ('username', models.CharField(max_length=39, primary_key=True, serialize=False)), 18 | ('name', models.CharField(max_length=255, null=True)), 19 | ('bio', models.CharField(max_length=160, null=True)), 20 | ('blog', models.CharField(max_length=255, null=True)), 21 | ('company', models.CharField(max_length=255, null=True)), 22 | ('location', models.CharField(max_length=255, null=True)), 23 | ('email', models.CharField(max_length=255, null=True)), 24 | ], 25 | ), 26 | ] 27 | -------------------------------------------------------------------------------- /Django/dataExtractor/github/migrations/0002_rename_blog_githubuser_websiteurl_and_more.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 4.0.2 on 2022-03-17 09:53 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('github', '0001_initial'), 10 | ] 11 | 12 | operations = [ 13 | migrations.RenameField( 14 | model_name='githubuser', 15 | old_name='blog', 16 | new_name='websiteURL', 17 | ), 18 | migrations.AddField( 19 | model_name='githubuser', 20 | name='followersCount', 21 | field=models.IntegerField(default=0), 22 | ), 23 | migrations.AddField( 24 | model_name='githubuser', 25 | name='forksObtained', 26 | field=models.IntegerField(default=0), 27 | ), 28 | migrations.AddField( 29 | model_name='githubuser', 30 | name='languageMostUsed', 31 | field=models.CharField(max_length=100, null=True), 32 | ), 33 | migrations.AddField( 34 | model_name='githubuser', 35 | name='profilePictureURL', 36 | field=models.CharField(max_length=255, null=True), 37 | ), 38 | migrations.AddField( 39 | model_name='githubuser', 40 | name='repositoriesCount', 41 | field=models.IntegerField(default=0), 42 | ), 43 | migrations.AddField( 44 | model_name='githubuser', 45 | name='starsObtained', 46 | field=models.IntegerField(default=0), 47 | ), 48 | ] 49 | -------------------------------------------------------------------------------- /Django/dataExtractor/dataExtractor/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for dataExtractor project. 3 | 4 | Generated by 'django-admin startproject' using Django 4.0.2. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/4.0/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/4.0/ref/settings/ 11 | """ 12 | 13 | from pathlib import Path 14 | 15 | # Build paths inside the project like this: BASE_DIR / 'subdir'. 16 | BASE_DIR = Path(__file__).resolve().parent.parent 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = 'django-insecure-+b^pde5#xdyc6yq^ii4s7lmne=5w-qg6!s=77%iw!d625#5v&p' 24 | 25 | # SECURITY WARNING: don't run with debug turned on in production! 26 | DEBUG = True 27 | 28 | ALLOWED_HOSTS = [] 29 | 30 | 31 | # Application definition 32 | 33 | INSTALLED_APPS = [ 34 | 'django.contrib.admin', 35 | 'django.contrib.auth', 36 | 'django.contrib.contenttypes', 37 | 'django.contrib.sessions', 38 | 'django.contrib.messages', 39 | 'django.contrib.staticfiles', 40 | 'github.apps.GithubConfig' 41 | ] 42 | 43 | MIDDLEWARE = [ 44 | 'django.middleware.security.SecurityMiddleware', 45 | 'django.contrib.sessions.middleware.SessionMiddleware', 46 | 'django.middleware.common.CommonMiddleware', 47 | 'django.middleware.csrf.CsrfViewMiddleware', 48 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 49 | 'django.contrib.messages.middleware.MessageMiddleware', 50 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 51 | ] 52 | 53 | ROOT_URLCONF = 'dataExtractor.urls' 54 | 55 | TEMPLATES = [ 56 | { 57 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 58 | 'DIRS': [], 59 | 'APP_DIRS': True, 60 | 'OPTIONS': { 61 | 'context_processors': [ 62 | 'django.template.context_processors.debug', 63 | 'django.template.context_processors.request', 64 | 'django.contrib.auth.context_processors.auth', 65 | 'django.contrib.messages.context_processors.messages', 66 | ], 67 | }, 68 | }, 69 | ] 70 | 71 | WSGI_APPLICATION = 'dataExtractor.wsgi.application' 72 | 73 | 74 | # Database 75 | # https://docs.djangoproject.com/en/4.0/ref/settings/#databases 76 | 77 | DATABASES = { 78 | 'default': { 79 | 'ENGINE': 'django.db.backends.postgresql', 80 | 'NAME': 'DataExtractionDatabase', 81 | 'USER' : 'postgres', 82 | 'PASSWORD' : 'postgres', 83 | 'HOST' : 'localhost' 84 | } 85 | } 86 | 87 | 88 | # Password validation 89 | # https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators 90 | 91 | AUTH_PASSWORD_VALIDATORS = [ 92 | { 93 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 94 | }, 95 | { 96 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 97 | }, 98 | { 99 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 100 | }, 101 | { 102 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 103 | }, 104 | ] 105 | 106 | 107 | # Internationalization 108 | # https://docs.djangoproject.com/en/4.0/topics/i18n/ 109 | 110 | LANGUAGE_CODE = 'en-us' 111 | 112 | TIME_ZONE = 'UTC' 113 | 114 | USE_I18N = True 115 | 116 | USE_TZ = True 117 | 118 | 119 | # Static files (CSS, JavaScript, Images) 120 | # https://docs.djangoproject.com/en/4.0/howto/static-files/ 121 | 122 | STATIC_URL = 'static/' 123 | 124 | # Default primary key field type 125 | # https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field 126 | 127 | DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' 128 | -------------------------------------------------------------------------------- /Django/dataExtractor/github/templates/extractedData.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | Extract Data From Github 18 | 19 | 29 | 30 | 31 | 32 | 33 |
34 |

35 | Extracted Data From Github 36 |

37 |
38 | 39 |
40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | {% for user in storedUsers %} 59 | 60 | 63 | 66 | 69 | 72 | 75 | 78 | 81 | 84 | 87 | 90 | 93 | 96 | 97 | {% endfor %} 98 | 99 |
UsernameFull NameEmailPersonal WebsiteLocationCompanyBioFollowers CountRepositories CountForks ObtainedStars ObtainedLanguage Most Used
61 | {{user.username}} 62 | 64 |

{{user.name|default_if_none:""}}

65 |
67 |

{{user.email|default_if_none:""}}

68 |
70 |

{{user.websiteURL|default_if_none:""}}

71 |
73 |

{{user.location|default_if_none:""}}

74 |
76 |

{{user.company|default_if_none:""}}

77 |
79 |

{{user.bio|default_if_none:""}}

80 |
82 |

{{user.followersCount|default_if_none:""}}

83 |
85 |

{{user.repositoriesCount|default_if_none:""}}

86 |
88 |

{{user.forksObtained|default_if_none:""}}

89 |
91 |

{{user.starsObtained|default_if_none:""}}

92 |
94 |

{{user.languageMostUsed|default_if_none:""}}

95 |
100 |
101 | 102 | 103 | 104 | 105 | 115 | 116 | 117 | 118 | -------------------------------------------------------------------------------- /Django/dataExtractor/github/views.py: -------------------------------------------------------------------------------- 1 | from ast import Not 2 | from dataclasses import dataclass 3 | import json 4 | from this import d 5 | from typing import final 6 | from django.db import IntegrityError 7 | from django.http import HttpResponse, HttpResponseRedirect 8 | from django.shortcuts import render 9 | import requests 10 | from .models import GithubUser 11 | from django.views.decorators.csrf import csrf_protect 12 | from django.utils.safestring import SafeString 13 | 14 | # Create your views here. 15 | 16 | def main(request): 17 | return render(request, "main.html",) 18 | 19 | def __graphqlQuery(searchedKeyword): 20 | variables = {"searchedKeyword" : searchedKeyword + " repos:>0"} #AUMENTAR TAMANO DE DATOS, EXTRAER TODO 21 | query = """ 22 | query($searchedKeyword : String!) 23 | { 24 | search(query: $searchedKeyword, type:USER, first: 50) 25 | { 26 | nodes 27 | { 28 | ... on User 29 | { 30 | login, 31 | name, 32 | avatarUrl, 33 | bio, 34 | email, 35 | location, 36 | company, 37 | websiteUrl 38 | followers(first: 0) 39 | { 40 | totalCount 41 | } 42 | repositories(first: 100) 43 | { 44 | totalCount, 45 | nodes 46 | { 47 | ... on Repository 48 | { 49 | stargazerCount, 50 | forkCount 51 | primaryLanguage 52 | { 53 | name 54 | } 55 | } 56 | } 57 | } 58 | } 59 | } 60 | } 61 | } 62 | """ 63 | 64 | header = {'Authorization': "token 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", 'content-type': 'application/json'} 65 | json = {'query' : query, 'variables' : variables} 66 | request = requests.post('https://api.github.com/graphql', json=json, headers=header) 67 | if request.status_code == 200: 68 | return request.json() 69 | else: 70 | return {} 71 | 72 | def extractData(request): 73 | searched = request.GET.get('query') 74 | if searched is not None and len(searched) != 0: 75 | result = [] 76 | 77 | data = __graphqlQuery(searched).get("data") 78 | searchedUsers = data.get("search") 79 | searchedUsersNodes = searchedUsers.get("nodes") 80 | usersJsonArray = searchedUsersNodes 81 | 82 | checkedUserCounter = 0 83 | while checkedUserCounter0): 122 | userJson["languageMostUsed"] = max(languagesUsed, key=languagesUsed.get) 123 | 124 | result.append(userJson) 125 | 126 | checkedUserCounter += 1 127 | 128 | context = { 129 | "users" : result, 130 | } 131 | return render(request, "extractData.html", context) 132 | 133 | return render(request, "extractData.html") 134 | 135 | @csrf_protect 136 | def createGithubUser(request): 137 | if request.method == 'POST': 138 | values = request.POST.dict() 139 | 140 | try: 141 | GithubUser.objects.update_or_create(**values) 142 | return HttpResponse(request.POST['name'] + " added!") 143 | except Exception as e: 144 | return HttpResponse("error...") 145 | else: 146 | return HttpResponse("error..") 147 | 148 | def extractedData(request): 149 | context = {"storedUsers" : GithubUser.objects.all()} 150 | return render(request, "extractedData.html", context) -------------------------------------------------------------------------------- /Django/dataExtractor/github/templates/extractData.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | Extract Data From Github 18 | 19 | 45 | 46 | 47 | 48 | 49 |
50 |

51 | Extract Data From Github 52 |

53 |
54 | 55 | 56 |
57 |
58 | 59 | 60 | 61 | 62 |
63 |
64 | 65 | {% if users is not None %} 66 |
67 | 68 |
69 | 70 |
71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | {% for user in users %} 85 | 86 | 89 | 92 | 95 | 98 | 101 | 104 | 108 | 109 | {% endfor %} 110 | 111 |
Profile PictureFull NameLanguage Most UsedRepositories CountTotal Stars EarnedTotal Forks Earned
87 | 88 | 90 |

{{user.name}}

91 |
93 |

{{user.languageMostUsed}}

94 |
96 |

{{user.repositoriesCount}}

97 |
99 |

{{user.starsObtained}}

100 |
102 |

{{user.forksObtained}}

103 |
105 | 106 | 107 |
112 |
113 | {% endif %} 114 | 115 | 116 | 117 | 143 | 144 | 170 | 171 | 172 | 173 | 174 | 184 | 185 | 186 | 187 | --------------------------------------------------------------------------------