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 urllib.request | |
import re | |
link = "https://habrahabr.ru/post/280644/" | |
website = urllib.request.urlopen(link) | |
html = website.read().decode() | |
links = re.findall('"((http|ftp)s?://.*?)"', html) |
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
submitHandler: function submitHandler(form, event) { | |
var values = { | |
toggler: $('#toggly').val(), | |
step1Unchecked: { | |
step1FirstRoofDeg: document.getElementById('range_1').noUiSlider.get(), | |
step1FirstRoofOrientation: $('#orientation-1').val(), | |
step1SecondRoofDeg: document.getElementById('range_2').noUiSlider.get(), | |
step1SecondRoofOrientation: $('#orientation-2').val(), | |
step1ResultCalculatorSquereMeters: $('#result_calculator').val() | |
}, |
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
# -*- coding: utf-8 -*- | |
from urllib.parse import urljoin | |
import scrapy | |
from selenium import webdriver | |
from scraper.items import AdsItem | |
from ads.models import URL | |
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
TypeError at /admin/ads/ads/6/change/ | |
__str__ returned non-string (type URL) | |
Request Method: GET | |
Request URL: http://127.0.0.1:8000/admin/ads/ads/6/change/ | |
Django Version: 1.10.4 | |
Exception Type: TypeError | |
Exception Value: | |
__str__ returned non-string (type URL) | |
Exception Location: /home/marni/work/agora/ENV/lib/python3.5/site-packages/django/utils/encoding.py in force_text, line 76 | |
Python Executable: /home/marni/work/agora/ENV/bin/python |
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
# -*- coding: utf-8 -*- | |
from urllib.parse import urlparse | |
from urllib.request import urlopen | |
from urllib.request import build_opener, Request, HTTPCookieProcessor | |
from http.cookiejar import CookieJar | |
import traceback | |
import time | |
import socket | |
from pyvirtualdisplay import Display | |
import scrapy |
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
a = [12,545,2,67,12,89,234,76,1,0,90] | |
def partition(arr, l, r): | |
x = arr[r] | |
i = l | |
for j in range(l, r): | |
if arr[j] <= x: | |
arr[i], arr[j] = arr[j], arr[i] | |
i += 1 |
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
# -*- coding: utf-8 -*- | |
import scrapy | |
class LfrSpider(scrapy.Spider): | |
name = "lfr" | |
allowed_domains = ["www.leboncoin.fr"] | |
start_urls = ['https://www.leboncoin.fr/ventes_immobilieres/'] | |
def parse(self, response): |
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 asyncio | |
import aiohttp | |
url1 = 'https://www.jonathanadler.com/art/by-artist/slim-aarons/slim-aarons-andldquo%3Bverbier-vacationandrdquo%3B-photograph/19135.html' | |
url2 = 'https://www.jonathanadler.com/furniture/by-category/benches-and-ottomans/x-bench/24-1900005.html?dwvar_24-1900005_base=NoBase&dwvar_24-1900005_quickShip=custom&dwvar_24-1900005_fabric=AntwerpSea&dwvar_24-1900005_fabricType=TexturedWoven' | |
async def request(url): | |
async with aiohttp.ClientSession() as session: | |
async with session.get(url) as response: |