Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try:
- print "what"
- newClassName = CourseNameAndCodeAssociation.objects.get(departmentCode__iexact = nameAndNumberStore[0])
- print newClassName
- except:
- print "HAHA"
- def newGetAllInformation(searchTerm):
- nameAndNumberStore = modifySearchTerm(searchTerm)
- urlStore = modifyUrl(nameAndNumberStore) # need to make the change here -- why not I go to the site, check for Course name - if that is not there switch, if it is then scrape
- soup = getHtml(urlStore)
- storeOfBooks = []
- storeOfBooks = scrape(soup,nameAndNumberStore)
- print nameAndNumberStore[0]
- try:
- newClassName = CourseNameAndCodeAssociation.objects.get(departmentCode__iexact = nameAndNumberStore[0])
- nameAndNumberStore = modifySearchTerm(newClassName.departmentName + " " + nameAndNumberStore[1])
- urlStore = modifyUrl(nameAndNumberStore)
- soup = getHtml(urlStore)
- storeOfBooks = scrape(soup,nameAndNumberStore)
- except:
- print "HAHA"
- return storeOfBooks
- try:
- print "what"
- newClassName = CourseNameAndCodeAssociation.objects.get(departmentCode__iexact = nameAndNumberStore[0])
- print newClassName
- except Exception as e:
- print "HAHA"
- print e
- except CourseNameAndCodeAssociation.DoesNotExist:
- department_code = name_and_number_store[0]
- class_names = CourseNameAndCodeAssociation.objects.all()
- try:
- new_class_name = class_names.get(departmentCode__iexact=department_code)
- except CourseNameAndCodeAssociation.DoesNotExist:
- print "HAHA"
- else:
- search_term = u'%s %s' % (new_class_name.departmentName,
- name_and_number_store[1])
- name_and_number_store = modify_search_term(search_term)
- url_store = modify_url(name_and_number_store)
- soup = get_html(url_store)
- store_of_books = scrape(soup, name_and_number_store)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement