Ghost Links:
import requests | |
from bs4 import BeautifulSoup | |
url = 'http://www.someurl.com.br/products' | |
headers = { | |
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36' | |
} | |
r = requests.get(url, headers=headers, timeout=5) |
import scrapy | |
from scrapymercado.items import ProductsItem | |
from scrapymercado.constants import URL | |
class ProductsSpider(scrapy.Spider): | |
name = "products" | |
def start_requests(self): | |
max_page_number = 67 |
import scrapy | |
from scrapymercado.items import ProductsItem | |
from scrapymercado.constants import URL | |
class ProductImgSpider(scrapy.Spider): | |
name = "productsimg" | |
def start_requests(self): | |
max_page_number = 67 |
import scrapy | |
from scrapy.contrib.pipeline.images import ImagesPipeline | |
from scrapymercado.constants import URLS_AND_NAMES | |
class ScrapymercadoPipeline(ImagesPipeline): | |
def get_media_requests(self, item, info): | |
for image_url in item.get('image_urls', []): | |
yield scrapy.Request(image_url, meta={'filepatch': URLS_AND_NAMES.get(image_url)}) |
export function getDayOfWeek(date) { | |
const dayOfWeek = new Date(date).getDay(); | |
return isNaN(dayOfWeek) ? null : ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'][dayOfWeek]; | |
} | |
export function getMonthName(date) { | |
const monthNumer = new Date(date).getMonth(); | |
return isNaN(monthNumer) ? null : ['January', 'February', 'March', 'April', 'May', 'June', | |
'July', 'August', 'September', 'October', 'November', 'December'][monthNumer]; | |
} |
from django import forms | |
from django.contrib import admin | |
from django.template.response import TemplateResponse | |
class RegularCreationAdminForm(forms.ModelForm): | |
class Meta: | |
model = ReactivationCoupon | |
fields = [ |
[error] | |
ImportError: No module named '_gdbm' | |
[solved] | |
sudo apt-get install python3.5-gdbm | |
[error] | |
ImportError: No module named 'apt_pkg' | |
[solved] | |
locate apt_pkg.so | |
sudo ln -s /usr/lib/python3/dist-packages/apt_pkg.cpython-34m-x86_64-linux-gnu.so /usr/lib/python3/dist-packages/apt_pkg.so |
import json | |
import falcon | |
FAKE_DB_MOVIE = [{ | |
"Title": "The Alienist", | |
"Year": "2018", | |
"Rated": "TV-MA", | |
"Released": "22 Jan 2018", | |
"Runtime": "60 min", | |
"Genre": "Drama, Mystery", |
import falcon | |
from .movies import Movie | |
api = application = falcon.API() | |
movie = Movie() | |
api.add_route('/movies', movie) |
Ghost Links: