- create a new repo
- clone to local
- .gitignore
- Markdown
- add a python file and run
- commit the file and push
- add another python file
- commit the file and push
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
{ | |
"responses": [ | |
{ | |
"textAnnotations": [ | |
{ | |
"locale": "it", | |
"description": "Unilever\nDove Dove\n国潮盛富 全民嗨购,\nDe Dove Dove ve\nम\n满88送88礼包\n", | |
"boundingPoly": { | |
"vertices": [ | |
{ |
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
<!DOCTYPE html> | |
<meta charset="UTF-8"> | |
<style> | |
.node circle { | |
fill: #fff; | |
stroke: steelblue; | |
stroke-width: 3px; | |
} |
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
class DuplicatesPipeline(object): | |
def __init__(self): | |
""" | |
Initializes database connection and sessionmaker. | |
Creates tables. | |
""" | |
engine = db_connect() | |
create_table(engine) | |
self.Session = sessionmaker(bind=engine) |
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
class SaveQuotesPipeline(object): | |
def __init__(self): | |
""" | |
Initializes database connection and sessionmaker | |
Creates tables | |
""" | |
engine = db_connect() | |
create_table(engine) | |
self.Session = sessionmaker(bind=engine) |
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 sqlalchemy import create_engine, Column, Table, ForeignKey, MetaData | |
from sqlalchemy.orm import relationship | |
from sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy import ( | |
Integer, String, Date, DateTime, Float, Boolean, Text) | |
from scrapy.utils.project import get_project_settings | |
Base = declarative_base() | |
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 scrapy | |
from scrapy.loader import ItemLoader | |
from tutorial.items import QuoteItem | |
class QuotesSpider(scrapy.Spider): | |
name = "quotes" | |
allowed_domains = ["toscrape.com"] | |
start_urls = ['http://quotes.toscrape.com/'] | |
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 scrapy.item import Item, Field | |
from scrapy.loader.processors import MapCompose, TakeFirst | |
from datetime import datetime | |
def remove_quotes(text): | |
# strip the unicode quotes | |
text = text.strip(u'\u201c'u'\u201d') | |
return text |
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 scrapy.item import Item, Field | |
from scrapy.loader.processors import MapCompose | |
def remove_quotes(text): | |
# strip the unicode quotes | |
text = text.strip(u'\u201c'u'\u201d') | |
return text | |