Skip to content

Instantly share code, notes, and snippets.

import pymysql
sql = """SELECT ID, post_title from wp_posts where post_type='post' and post_status='publish' """
# conn = psycopg2.connect(dbname=f'{dbname}', user=f'{user}', password=f'{password}', host=f'{host}')
conn = pymysql.connect('xx.xx.xx.xxx', 'xxx',
'xxx', 'xxx')
data = pd.read_sql_query(sql, conn)
all_file_ner = ['links_to_lenta_by_ner_pravo.csv', 'links_to_lenta_by_ner_buh.csv', 'links_to_lenta_by_ner_ekonom.csv', 'links_to_lenta_by_ner_all.csv']
for file in all_file_ner:
new_df = pd.read_csv(file)
all_lenta_ner = all_lenta_ner.append(new_df)
@zilista
zilista / work_with_postgresql.py
Created April 14, 2020 11:49
Working with a PostgreSQL Database
import psycopg2
import csv
dbname = 'xxxxx'
user = 'xxxxx'
password = 'xxxxxx'
host = '111.111.11.1'
def connector_db(dbname, user, password, host):
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import nltk
from nltk.stem import PorterStemmer, WordNetLemmatizer
from nltk.stem.snowball import SnowballStemmer
from nltk.corpus import stopwords
from string import punctuation
# import ssl
#
# try:
# _create_unverified_https_context = ssl._create_unverified_context
import random
from requests_html import HTMLSession
from queue import Queue
from threading import Lock
from concurrent.futures import ThreadPoolExecutor
LIST_KEY_AVAILABILITY = ['xxxxxxxxxxxxxxxxxxxxxx', 'xxxxxxxxxxxxxxxxxxxxxx']
lock = Lock()
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.