This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from celery import Task | |
from .naver import SocialsCrawlNaverTask | |
from .daum import SocialsCrawlDaum | |
from .nate import SocialsCrawlNate | |
class SocialsCrawlAllTask(Task): | |
def run(self, keyword_id): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from celery import Task | |
from socials.models import Keyword | |
class SocialsCrawlNaverTask(Task): | |
def run(self, keyword_id): | |
keyword = Keyword.objects.get(pk=keyword_id) | |
keyword.crawl_naver() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
from socials.utils import NaverCrawling | |
class Keyword(models.Model): | |
name = models.CharField( | |
max_length=30, | |
unique=True, | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db.models.signals import post_save | |
from django.dispatch import receiver | |
from socials.models import Keyword | |
from socials.tasks import SocialsCrawlAllTask | |
@receiver(post_save, sender=Keyword) | |
def post_save_keyword(sender, instance, created, **kwargs): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from bs4 import BeautifulSoup | |
class NaverCrawling: | |
def __init__(self): | |
self.naver_blog = "https://search.naver.com/search.naver?where=post&ie=utf8&query={query}&start={start}" | |
def naver_blog_page(self, search_keyword, page): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-r requirements/production.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
from socials.utils import NaverCrawling | |
class Keyword(models.Model): | |
name = models.CharField( | |
max_length=30, | |
unique=True, | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
class Keyword(models.Model): | |
name = models.CharField( | |
max_length=20, | |
) | |
created_at = models.DateTimeField( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib import admin | |
from announce.models import SMS, Slack, Email | |
@admin.register(SMS) | |
@admin.register(Slack) | |
@admin.register(Email) | |
class AnnouncesAdminModel(admin.ModelAdmin): | |
list_display = admin.ModelAdmin.list_display + ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from posts.models import Post | |
from rest_framework import serializers | |
class PostDetailSerializer(serializers.HyperlinkedModelSerializer): | |
username = serializers.CharField(source="user.username") | |
class Meta: | |
model = Post |
OlderNewer