#-*- coding:utf-8 -*-

import threading
import requests
import time
import urllib3
import json

urllib3.disable_warnings()

def getCrawl(url):
     session = requests.Session()
     session.trust_env = False
     session.verify = False
     receive = session.get(url)
     text = receive.text
     # text = text.encode('utf-8')
     mtext = json.dumps({"k": text})
     # print(json.loads(mtext)["k"])
     text = json.loads(mtext)["k"];
     time.sleep(1)
     print(text)
     get_data = json.dumps(text, indent=4)
     print(get_data)
target = "http://somesite.co.kr/uri1/uri2"
thread = threading.Thread(target=getCrawl, args=(target,))
thread.daemon = False
thread.start()

#print('Out of thread')

'Python' 카테고리의 다른 글

Getting snmp informations with python script  (0) 2020.04.22
USING THREAD IN PYTHON  (0) 2020.04.07
CRAWLING WITH PYTHON  (0) 2020.04.07
TRY TO CONNECT VIA SMB OR CIFS  (0) 2020.04.07
TRY TO CONNECT VIA MYSQL  (0) 2020.04.07
import threading
import requests
import time

def getCrawl(url):
     session = requests.Session()
     session.trust_env = False
     session.verify = False
     receive = session.get(url)
     text = receive.text
     time.sleep(7)
     print(text)

thread1 = threading.Thread(target=getCrawl, args=('http://www.google.com',))
thread1.daemon = False
thread1.start()
print('Out of thread')

'Python' 카테고리의 다른 글

Crawling Json type with Python thread  (0) 2020.04.26
Getting snmp informations with python script  (0) 2020.04.22
CRAWLING WITH PYTHON  (0) 2020.04.07
TRY TO CONNECT VIA SMB OR CIFS  (0) 2020.04.07
TRY TO CONNECT VIA MYSQL  (0) 2020.04.07

+ Recent posts