def test(): namelist = name.getName() for n in namelist: n = n.split('&')[0] delay = 8 * random.random() + 8 time.sleep(delay) print("----------expersise of " + n + " is: ---------------") print(getExpertiseFromGooglescholar(n)) #test()
def getExpertiseOfAllNameList(): namelistAuthors = name.getName() for nl in namelistAuthors: r = requests.get('https://www.researchgate.net/profile/' + nl) expertList = [] soup = BeautifulSoup(r.text, 'html.parser') mydivs = soup.findAll("a", {"class": "profile-about__badge"}) for title in mydivs: expertList.append(title.get_text()) if len(expertList) != 0: print(nl) print(expertList)
import psycopg2 import name print("Working?") #Define our connection string conn_string = "host='localhost' dbname='CSE190' user='******' password='******'" # print the connection string we will use to connect print("Connecting to database ", conn_string) # get a connection, if a connect cannot be made an exception will be raised here conn = psycopg2.connect(conn_string) # conn.cursor will return a cursor object, you can use this cursor to perform queries cursor = conn.cursor() print("Connected!") cursor.execute( "CREATE TABLE member (id INT NOT NULL PRIMARY KEY, name VARCHAR(30), nation VARCHAR(30), birthday VARCHAR(10), time_stamp VARCHAR(30));" ) cursor.execute( "CREATE TABLE friends (member1 INT NOT NULL, member2 INT NOT NULL, time_stamp VARCHAR(30), PRIMARY KEY (member1, member2), FOREIGN KEY (member1) REFERENCES member, FOREIGN KEY (member2) REFERENCES member);" ) cursor.execute( "CREATE TABLE topics (id INT NOT NULL PRIMARY KEY, name VARCHAR(30));") cursor.execute( "CREATE TABLE posts (id INT NOT NULL PRIMARY KEY, postedBy INT NOT NULL, title VARCHAR(30), textBody VARCHAR(150), time_stamp VARCHAR(15), topic INT NOT NULL, FOREIGN KEY (postedBy) REFERENCES member, FOREIGN KEY (topic) REFERENCES topics);" ) cursor.execute(
import psycopg2 import sys import random import name import time #Define our connection string conn_string = "host='localhost' dbname='CSE190' user='******' password='******'" # print the connection string we will use to connect print ("Connecting to database ", conn_string, "") # get a connection, if a connect cannot be made an exception will be raised here conn = psycopg2.connect(conn_string) # conn.cursor will return a cursor object, you can use this cursor to perform queries cursor = conn.cursor() print ("Connected!\n") ####################################################################################### # Disabling the trigger temporarily. Comment if not neeeded #cursor.execute("ALTER TABLE member DISABLE TRIGGER add_to_post") #conn.commit() ######################################################################################## filename = "first_names.txt" file = open(filename, "r")
def extract(): my_url = request.values.get('url') extract_result = nm.getName(my_url) #print(extract_result) return extract_result
# print(qrtext) #[0] testid, [1] test number, [2] page number, [3] number of questions on page qrArray = qrtext.split(',') print(qrArray) tests = user['tests'] if (len(qrArray) <= 2): qcystart = int(PAGE_HEIGHT / 8) qcyend = int(6 * PAGE_HEIGHT / 8) qcxstart = int(PAGE_WIDTH / 10) qcxend = int(9 * PAGE_WIDTH / 10) nameROI = [ paper[0][qcystart:qcyend, qcxstart:qcxend], paper[1][qcystart:qcyend, qcxstart:qcxend] ] name = getName(nameROI, 10, 16, PAGE_WIDTH) functions.writeImage(name[0], temp_dir + 'page' + str(i) + '.png') smallerImage = cv2.resize(name[0], None, fx=.5, fy=.5, interpolation=cv2.INTER_LINEAR) functions.writeImage(smallerImage, temp_dir + 'graded_' + str(i) + '.png') temp = open(temp_dir + 'graded_' + str(i) + '.png', 'rb') png64 = temp.read() png64 = base64.b64encode(png64) gradedId = fs.put(png64) # when we get a name, we add it to testTakers # tests = user['tests']
def say_hello(): return "Hello " + name.getName()