当前位置: 首页>>代码示例>>Python>>正文


Python Scraper.scrap方法代码示例

本文整理汇总了Python中scraper.Scraper.scrap方法的典型用法代码示例。如果您正苦于以下问题:Python Scraper.scrap方法的具体用法?Python Scraper.scrap怎么用?Python Scraper.scrap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在scraper.Scraper的用法示例。


在下文中一共展示了Scraper.scrap方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from scraper import Scraper [as 别名]
# 或者: from scraper.Scraper import scrap [as 别名]
def main(request):
	username = request.POST['username']
	password = request.POST['password']
	scraper = Scraper(username, password)
	data = scraper.scrap(True)

	return HttpResponse(obj2json(data), mimetype='application/json')
开发者ID:castelanjr,项目名称:uNotas,代码行数:9,代码来源:views.py

示例2: main

# 需要导入模块: from scraper import Scraper [as 别名]
# 或者: from scraper.Scraper import scrap [as 别名]
def main():
	p = optparse.OptionParser()
	p.add_option('--username', '-u')	
	p.add_option('--password', '-p')
	options, arguments = p.parse_args()
	if options.username and options.password:
		scraper = Scraper(options.username, options.password.decode('utf-8'))
		try:
			student = scraper.scrap()
			print '%s - %s' % (student.name, student.course)
			for semester in student.semesters:
				print '\nSemester: %s' % semester.period
				for discipline in semester.disciplines:
					print 'Discipline: %s' % discipline.name
					for grade in discipline.grades:
						print '%s - %s' % (grade.name.decode('utf-8'), grade.value)
		except Exception, e:
			print 'Could not fetch grades: %s' % e.message
开发者ID:castelanjr,项目名称:uNotas,代码行数:20,代码来源:unotas.py

示例3: open

# 需要导入模块: from scraper import Scraper [as 别名]
# 或者: from scraper.Scraper import scrap [as 别名]
from scraper import Scraper

if __name__ == "__main__":
    links = []
    doc = open("URLs.csv", "r").read()
    try:
        for line in doc.split("\n"):
            l = line.split(";")[-2]
            links.append("https://www.sec.gov/Archives/" + l + "-index.htm")
    except:
        pass

    errors = open("errors.txt", "w")
    try:
        for index, link in enumerate(links[:1000]):
            # try:
            print index, Scraper.scrap(link)
            print
            # except Exception as ex:
            #     errors.write(str(index) + ":  " + str(link) + "\n")
    finally:
        errors.close()
开发者ID:stassavchuk,项目名称:UpWork-Python-Scripts,代码行数:24,代码来源:test.py


注:本文中的scraper.Scraper.scrap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。