This file contains hidden or 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 scrapy | |
from scrapy.crawler import CrawlerProcess | |
from scrapy.utils.project import get_project_settings | |
class LazyCrawler(scrapy.Spider): | |
name = "quotes" | |
def start_requests(self): | |
This file contains hidden or 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 datetime | |
def get_current_date(format="%Y-%m-%d"): | |
""" | |
Returns the current date | |
:param format: desired Date format | |
examples: | |
%Y-%m-%d | |
%d-%m-%Y | |
%Y/%m/%d |
This file contains hidden or 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 weasyprint | |
from django.conf import settings | |
from django_weasyprint.utils import django_url_fetcher | |
from django.template.loader import get_template | |
from django.http.response import HttpResponse | |
def build_pdf(request,html_content, header_html=None, footer_html=None): | |
""" | |
Build a pdf and returns its binary content |
This file contains hidden or 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
# -*- encoding: utf-8 -*- | |
""" | |
Copyright (c) 2021 - present Theragen Genome Care | |
""" | |
from django.contrib.auth import REDIRECT_FIELD_NAME | |
from django.contrib.auth.decorators import user_passes_test | |
from django.shortcuts import redirect | |