第六版计算机网络:第9章网络管理简介与框架

版权申诉
0 下载量 68 浏览量 更新于2024-07-03 收藏 2.14MB PPT 举报
本资源是计算机网络第6版课程讲义,由Jim Kurose和Keith Ross合著,出自Addison-Wesley出版社,发行于2012年3月。课程专注于Chapter 9 - Network Management,采用自上而下的方法探讨网络管理。这些PowerPoint幻灯片旨在免费提供给所有师生和读者,以便他们可以根据需求添加、修改或删除内容,享受教学和学习过程。 网络管理这一章节的目标主要包括以下几点: 1. **动机介绍**:章节首先会讨论网络管理的重要性,阐述为何需要对其进行有效的管理,包括提高网络性能、故障诊断与修复、资源优化以及保障网络安全等。 2. **主要组成部分**:讲解网络管理的基本架构,包括监控系统、配置管理、故障检测、性能测量、安全管理和计费管理等关键模块,这些组件共同确保网络的高效运行。 3. **互联网网络管理框架**:介绍标准框架如SNMP (Simple Network Management Protocol) 和CMIS/CMIP (Configuration Management Information System/Communication Management Information Protocol),这些协议在统一网络管理实践中扮演着核心角色。 4. **MIB(管理信息库)与SMI(数据定义语言)**:MIB是网络设备上的数据库,存储了设备状态和性能数据,而SMI则是用于描述这些数据结构的语言,使得网络管理系统能够理解和操作这些信息。 5. **标准化和版权声明**:使用这些幻灯片时,作者强调两点要求:一是若在课堂上使用,请提及其来源,支持原作者的著作;二是如果在网站上传播,请注明这些幻灯片来源于作者,并尊重其版权。 本章内容深入浅出地介绍了网络管理的基础理论和技术实践,是网络工程和IT专业人员理解网络维护和优化不可或缺的一部分。通过学习和应用这些知识,用户可以提升网络运维的效率和可靠性。

import requests import os from bs4 import BeautifulSoup class book_spider(): def __init__(self,root_url): self.root_url=root_url self.book_list=[] #一级页面中获取的数据(二级页面地址)存放于此列表 self.chapter_list=[] #二级页面中获取的数据(三级页面地址和章节名)存放于此列表 def get_url(url): while True: try: res=requests.get(url) if res.status_code==200: res.encoding =res.apparent_encoding print("页面获取成功") return res.text else: print("页面返回异常",res.status_code) except: print("页面获取错误") def get_book_list(self.url): res = self.get_url(url) html = BeautifulSoup(res,"html.parser") a_list = html.find_all("a",{"class":"name"}) for a in a_list: self.book_list.append(a["href"]) self.book_list = [self.root_url+i for i in self.bbok_list] self.book_list.remove('http://10.1.88.252:7000/庆余年') print(book_list) def get_chapter_list(self,url): res = self.get_url(url) html = BeautifulSoup(res,"html.parser") a_list = html.find_all("a",{"class":"chapter"}) for a in a_list: self.chapter_list.append((a["href"],a.text.replace("\n",""))) def get_content(self.chapter): url = self.root_url + chapter[0] print(url) book_name = chapter[0].split("/")[1] print(book_name) if not os.path.exists(book_name): os.mkdir(book_name) res = self.get_url(url) html = BeautifulSoup(res,"html.parser") content = html.find("div",{"id":"content"}).text print(content) path = os.path.join(book_name,chapter[1]) with open(path,"w",encoding="utf8") as f: f.write(content) def main(): self.get_book_list(self.root_url) for book in self.book_list: self.get_chapter_liat(book) for chapter in chapter_list: self.get_content(chapter) book_s = book_spider("http://10.1.88.252:7000") book_s.main()这是一段爬虫代码,找出里面的错误并改正

2023-06-02 上传

帮我把一下代码设置一个合理请求头,并加入一个延时import requests import os from bs4 import BeautifulSoup class NovelDownloader: def __init__(self, root_url): self.root_url = root_url self.book_list = [] self.chapter_list = [] def get_url(self, url): while True: try: res = requests.get(url) if res.status_code == 200: print("页面获取成功!") return res.text else: print("页面返回异常!", res.status_code) except: print("页面获取错误!") def get_book_list(self): res = self.get_url(self.root_url) html = BeautifulSoup(res, "html.parser") a_list = html.find_all("a", {"class": "name"}) for a in a_list: self.book_list.append(a["href"]) self.book_list = [self.root_url + i for i in self.book_list] self.book_list.remove('http://www.biquge5200.cc/') def get_chapter_list(self, url): res = self.get_url(url) html = BeautifulSoup(res, "html.parser") a_list = html.find_all("a", {"class": "chapter"}) for a in a_list: self.chapter_list.append((a["href"], a.text.replace("\n", ""))) def get_content(self, chapter): url = self.root_url + chapter[0] print(url) book_name = chapter[0].split("/")[1] print(book_name) if not os.path.exists(book_name): os.mkdir(book_name) res = self.get_url(url) html = BeautifulSoup(res, "html.parser") content = html.find("div", {"id": "content"}).text print(content) path = os.path.join(book_name, chapter[1]) with open(path, "w", encoding="utf8") as f: f.write(content) def main(self): self.get_book_list() for book in self.book_list: self.get_chapter_list(book) for chapter in self.chapter_list: self.get_content(chapter) if __name__ == '__main__': root_url = "http://www.biquge5200.cc/" nd = NovelDownloader(root_url) nd.main()

2023-06-02 上传