Add swagger integration
This commit is contained in:
parent
752ba62aee
commit
61702e720a
4 changed files with 178 additions and 1 deletions
|
|
@ -6,6 +6,7 @@ chardet==3.0.4
|
|||
Django==2.2
|
||||
django-celery-beat==1.5.0
|
||||
djangorestframework==3.9.4
|
||||
django-rest-swagger-2.2.0
|
||||
lxml==4.3.4
|
||||
feedparser==5.2.1
|
||||
idna==2.8
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ INSTALLED_APPS = [
|
|||
"django.contrib.staticfiles",
|
||||
# third party apps
|
||||
"rest_framework",
|
||||
"rest_framework_swagger",
|
||||
"celery",
|
||||
"django_celery_beat",
|
||||
# app modules
|
||||
|
|
|
|||
168
src/newsreader/fixtures/local/fixture.json
Normal file
168
src/newsreader/fixtures/local/fixture.json
Normal file
|
|
@ -0,0 +1,168 @@
|
|||
[
|
||||
{
|
||||
"fields" : {
|
||||
"is_active" : true,
|
||||
"is_superuser" : true,
|
||||
"task_interval" : null,
|
||||
"user_permissions" : [],
|
||||
"is_staff" : true,
|
||||
"last_name" : "",
|
||||
"first_name" : "",
|
||||
"groups" : [],
|
||||
"date_joined" : "2019-07-14T10:44:35.228Z",
|
||||
"password" : "pbkdf2_sha256$150000$vAOYP6XgN40C$bvW265Is2toKzEnbMmLVufd+DA6z1kIhUv/bhtUiDcA=",
|
||||
"task" : null,
|
||||
"last_login" : "2019-07-14T12:28:05.473Z",
|
||||
"email" : "sonnyba871@gmail.com"
|
||||
},
|
||||
"pk" : 1,
|
||||
"model" : "accounts.user"
|
||||
},
|
||||
{
|
||||
"model" : "accounts.user",
|
||||
"fields" : {
|
||||
"task" : null,
|
||||
"email" : "sonny@bakker.nl",
|
||||
"last_login" : "2019-07-20T07:52:59.491Z",
|
||||
"first_name" : "",
|
||||
"groups" : [],
|
||||
"last_name" : "",
|
||||
"password" : "pbkdf2_sha256$150000$SMI9E7GFkJQk$usX0YN3q0ArqAd6bUQ9sUm6Ugms3XRxaiizHGIa3Pk4=",
|
||||
"date_joined" : "2019-07-18T18:52:36.080Z",
|
||||
"is_staff" : true,
|
||||
"task_interval" : null,
|
||||
"user_permissions" : [],
|
||||
"is_active" : true,
|
||||
"is_superuser" : true
|
||||
},
|
||||
"pk" : 2
|
||||
},
|
||||
{
|
||||
"pk" : 3,
|
||||
"fields" : {
|
||||
"favicon" : null,
|
||||
"category" : null,
|
||||
"url" : "https://news.ycombinator.com/rss",
|
||||
"error" : null,
|
||||
"user" : 2,
|
||||
"succeeded" : true,
|
||||
"modified" : "2019-07-20T11:28:16.473Z",
|
||||
"last_suceeded" : "2019-07-20T11:28:16.316Z",
|
||||
"name" : "Hackers News",
|
||||
"website_url" : null,
|
||||
"created" : "2019-07-14T13:08:10.374Z",
|
||||
"timezone" : "UTC"
|
||||
},
|
||||
"model" : "collection.collectionrule"
|
||||
},
|
||||
{
|
||||
"model" : "collection.collectionrule",
|
||||
"pk" : 4,
|
||||
"fields" : {
|
||||
"favicon" : null,
|
||||
"category" : 2,
|
||||
"url" : "http://feeds.bbci.co.uk/news/world/rss.xml",
|
||||
"error" : null,
|
||||
"user" : 2,
|
||||
"succeeded" : true,
|
||||
"last_suceeded" : "2019-07-20T11:28:15.691Z",
|
||||
"name" : "BBC",
|
||||
"modified" : "2019-07-20T12:07:49.164Z",
|
||||
"timezone" : "UTC",
|
||||
"website_url" : null,
|
||||
"created" : "2019-07-20T11:24:32.745Z"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk" : 5,
|
||||
"fields" : {
|
||||
"error" : null,
|
||||
"category" : null,
|
||||
"url" : "http://feeds.arstechnica.com/arstechnica/index?fmt=xml",
|
||||
"favicon" : null,
|
||||
"timezone" : "UTC",
|
||||
"created" : "2019-07-20T11:24:50.411Z",
|
||||
"website_url" : null,
|
||||
"name" : "Ars Technica",
|
||||
"succeeded" : true,
|
||||
"last_suceeded" : "2019-07-20T11:28:15.986Z",
|
||||
"modified" : "2019-07-20T11:28:16.033Z",
|
||||
"user" : 2
|
||||
},
|
||||
"model" : "collection.collectionrule"
|
||||
},
|
||||
{
|
||||
"model" : "collection.collectionrule",
|
||||
"pk" : 6,
|
||||
"fields" : {
|
||||
"favicon" : null,
|
||||
"category" : 2,
|
||||
"url" : "https://www.theguardian.com/world/rss",
|
||||
"error" : null,
|
||||
"user" : 2,
|
||||
"name" : "The Guardian",
|
||||
"succeeded" : true,
|
||||
"last_suceeded" : "2019-07-20T11:28:16.078Z",
|
||||
"modified" : "2019-07-20T12:07:44.292Z",
|
||||
"created" : "2019-07-20T11:25:02.089Z",
|
||||
"website_url" : null,
|
||||
"timezone" : "UTC"
|
||||
}
|
||||
},
|
||||
{
|
||||
"fields" : {
|
||||
"url" : "http://feeds.feedburner.com/tweakers/mixed?fmt=xml",
|
||||
"category" : 1,
|
||||
"error" : null,
|
||||
"favicon" : null,
|
||||
"timezone" : "UTC",
|
||||
"website_url" : null,
|
||||
"created" : "2019-07-20T11:25:30.121Z",
|
||||
"user" : 2,
|
||||
"last_suceeded" : "2019-07-20T11:28:15.860Z",
|
||||
"succeeded" : true,
|
||||
"modified" : "2019-07-20T12:07:28.473Z",
|
||||
"name" : "Tweakers"
|
||||
},
|
||||
"pk" : 7,
|
||||
"model" : "collection.collectionrule"
|
||||
},
|
||||
{
|
||||
"model" : "collection.collectionrule",
|
||||
"pk" : 8,
|
||||
"fields" : {
|
||||
"category" : 1,
|
||||
"url" : "https://www.theverge.com/rss/index.xml",
|
||||
"error" : null,
|
||||
"favicon" : null,
|
||||
"created" : "2019-07-20T11:25:46.256Z",
|
||||
"website_url" : null,
|
||||
"timezone" : "UTC",
|
||||
"user" : 2,
|
||||
"last_suceeded" : "2019-07-20T11:28:16.034Z",
|
||||
"succeeded" : true,
|
||||
"modified" : "2019-07-20T12:07:21.704Z",
|
||||
"name" : "The Verge"
|
||||
}
|
||||
},
|
||||
{
|
||||
"pk" : 1,
|
||||
"fields" : {
|
||||
"user" : 2,
|
||||
"name" : "Tech",
|
||||
"modified" : "2019-07-20T12:07:17.396Z",
|
||||
"created" : "2019-07-20T12:07:10Z"
|
||||
},
|
||||
"model" : "core.category"
|
||||
},
|
||||
{
|
||||
"model" : "core.category",
|
||||
"pk" : 2,
|
||||
"fields" : {
|
||||
"user" : 2,
|
||||
"modified" : "2019-07-20T12:07:42.329Z",
|
||||
"name" : "World News",
|
||||
"created" : "2019-07-20T12:07:34Z"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -2,12 +2,19 @@ from django.conf import settings
|
|||
from django.contrib import admin
|
||||
from django.urls import include, path
|
||||
|
||||
from rest_framework_swagger.views import get_swagger_view
|
||||
|
||||
from newsreader.accounts.urls import urlpatterns as login_urls
|
||||
from newsreader.news.collection.urls import endpoints as collection_endpoints
|
||||
from newsreader.news.core.urls import endpoints as core_endpoints
|
||||
|
||||
|
||||
endpoints = collection_endpoints + core_endpoints
|
||||
schema_view = get_swagger_view(title="Newsreader API")
|
||||
endpoints = [
|
||||
path("", schema_view, name="schema-view"),
|
||||
*collection_endpoints,
|
||||
*core_endpoints,
|
||||
]
|
||||
|
||||
urlpatterns = [
|
||||
path("accounts/", include((login_urls, "accounts")), name="accounts"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue