jenkins插件依赖2

论坛 期权论坛 编程之家     
选择匿名的用户   2021-6-2 20:38   2737   0

import requests
from bs4 import BeautifulSoup

def get_dependecy():
headers ={
'user-agent':'Mozilla/5.0 (Windows NT 6.1; Win64;x 64) AppleWebKit/537.36(KHTML, like Gecko) Chrome/52.0.2743.82 Sarari/537.36',
'Host':'plugins.jenkins.io'
}
dependecy_list=[]
link = 'https://plugins.jenkins.io/gerrit-trigger'
r=requests.get(link,headers= headers,timeout =10)
soup = BeautifulSoup(r.text,"lxml")
print(soup.find('h1',class_='title').text.strip())
div_list = soup.find_all('div',class_='required')
for each in div_list:
dependecy = each.a.text.strip()
dependecy_list.append(dependecy)
div_list = soup.find_all('div',class_='optional')
for each in div_list:
dependecy = each.a.text.strip()
dependecy_list.append(dependecy)
div_list = soup.find_all('div',class_='implied')
for each in div_list:
dependecy = each.a.get('href')
dependecy_list.append(dependecy)
return dependecy_list
rmp=[]
tmp=get_dependecy()
print(tmp)

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP