Adding lab 9 files, still need to get Requests working

parent 1852b850
Pipeline #21103 passed with stages
in 2 minutes and 54 seconds
Rem this is just a file that lets me hit "CTRL-SHIFT-B" in VSCode to build an executable
@echo off
@echo "Building Lab 7"
g++ -o lab-07/lab7 lab-07/main.cpp
import sys
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
class ASWWU:
def __init__(self):
self.driver = webdriver.Firefox()
self.driver.implicitly_wait(5) # seconds
self.driver.get('https://aswwu.com/')
def searchMask(self, name):
xpath = "//a[contains(@href, 'https://aswwu.com/mask')]"
self.driver.find_element_by_xpath(xpath).click()
self.driver.find_element_by_id('mask-search-query').send_keys(name, Keys.ENTER)
self.driver.implicitly_wait(5) # seconds
xpath = "//search-results[contains(@ng-reflect-query,'" + name + "')]"
self.driver.find_element_by_xpath(xpath)
xpath = "//h4[contains(text(),'" + name + "')]"
result = self.driver.find_elements_by_xpath(xpath)
return result
# Logout code. I wasn't sure
def close(self):
self.driver.find_element_by_id('bubbleicon').click()
self.driver.find_element_by_xpath("//div[@class='dropdown-menu show']/button").click()
# add login() [x], updateProfile(), and close() to ASWWU
# iterate over a dictionary with `for key, value in dict.items():`
def main():
names = [ "Benko", "DePaula", "Fairchild", "Hartman", "Herbel",
"Hernandez", "Jones", "Moody", "Price", "Reklai", "Riggs",
"Smith", "Sukachevin", "Taylor", "Thomsen", "Tinker" ]
start = time.time()
aswwu = ASWWU()
for name in names:
aswwu.searchMask(name)
aswwu.close()
end = time.time()
print(end - start)
if __name__ == "__main__":
main()
import sys
import time
import requests
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
def main():
names = [ "Benko", "DePaula", "Fairchild", "Hartman", "Herbel",
"Hernandez", "Jones", "Moody", "Price", "Reklai", "Riggs",
"Smith", "Sukachevin", "Taylor", "Thomsen", "Tinker" ]
start = time.time()
for name in names:
r = requests.get("https://aswwu.com/mask/search?query=" + name)
print(r.text, r.status_code)
end = time.time()
print(end - start)
# def main():
# names = [ "Benko", "DePaula", "Fairchild", "Hartman", "Herbel",
# "Hernandez", "Jones", "Moody", "Price", "Reklai", "Riggs",
# "Smith", "Sukachevin", "Taylor", "Thomsen", "Tinker" ]
# start = time.time()
# aswwu = ASWWU()
# for name in names:
# aswwu.searchMask(name)
# aswwu.close()
# end = time.time()
# print(end - start)
if __name__ == "__main__":
main()
1644416924833 geckodriver INFO Listening on 127.0.0.1:1110
1644416927874 mozrunner::runner INFO Running command: "C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe" "--marionette" "--remote-debugging-port" "1111" "-no-remote" "-profile" "C:\\Users\\brado\\AppData\\Local\\Temp\\rust_mozprofilegVWrlr"
1644416928213 Marionette INFO Marionette enabled
console.warn: SearchSettings: "get: No settings file exists, new profile?" (new NotFoundError("Could not open the file at C:\\Users\\brado\\AppData\\Local\\Temp\\rust_mozprofilegVWrlr\\search.json.mozlz4", (void 0)))
DevTools listening on ws://localhost:1111/devtools/browser/d33cff45-7ea3-40a9-8402-bd73912835c5
1644416930291 Marionette INFO Listening on port 1117
1644416930576 RemoteAgent WARN TLS certificate errors will be ignored for this session
1644417206861 Marionette INFO Stopped listening on port 1117
console.warn: TopSitesFeed: Failed to fetch data from Contile server: NetworkError when attempting to fetch resource.
###!!! [Parent][PGPUParent] Error: RunMessage(msgname=PGPU::Msg_ShutdownVR) Channel closing: too late to send/recv, messages will be lost
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment