Skip to content

Instantly share code, notes, and snippets.

View amarynets's full-sized avatar

Andrii Marynets amarynets

  • Ukraine
View GitHub Profile
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()
},
# -*- coding: utf-8 -*-
from urllib.parse import urljoin
import scrapy
from selenium import webdriver
from scraper.items import AdsItem
from ads.models import URL
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
# -*- 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
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
# -*- 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):
@amarynets
amarynets / 301_redirection.py
Created July 11, 2018 08:37
aiohttp does a 10 redirection
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: