栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

python 清除 nexus 里面的镜像

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

python 清除 nexus 里面的镜像

在这里下对应的 chromedriver 

 https://chromedriver.storage.googleapis.com/ 

替换到此目录即可

 

chrome --remote-debugging-port=9222 --user-data-dir="D:/chrone_data"

import json
import os
import selenium
from selenium import webdriver
import pathlib
import time
from selenium.webdriver.common.keys import Keys

 
options = webdriver.ChromeOptions()
options.add_experimental_option("debuggerAddress", "127.0.0.1:9222")
driver = webdriver.Chrome(options = options)
 
 
def SLEEP(min=3):
    time.sleep(min) 
import shutil
def publish(id):  
     
    start_url = "http://XXXX:"+ id
    # start_url = "http://XXXX"
    driver.get(start_url)  
    now_handle = driver.current_window_handle
    print(now_handle)
    # SLEEP(5)
    # driver.find_element_by_xpath('/html/body/div[1]/div/div/div[3]/div/div[2]/div/div/div/div/div[1]/div/div/div[1]/div/div/div/div/div/div[4]/div/div[2]/div[1]/div[2]/table[1]').click()
    SLEEP(3)
    driver.find_element_by_xpath('//*[@id="nx-button-1201"]').click()    
    SLEEP(1)
    driver.find_element_by_xpath('//*[@id="button-1006-btnInnerEl"]').click()
    SLEEP(3) 


if __name__ == '__main__': 
    # 获取下列表数据
    data = [
    {
        "id": "22b3686a9064fa3d24e25f3dc1f73a92",
        "repositoryName": "maven-releases",
        "group": "com.xxx",
        "name": "xxxx",
        "version": "0.0.3.29.tom.8",
        "format": "maven2"
    },
    {
        "id": "c60bc6b9612f47d35a7e604af359633f",
        "repositoryName": "maven-releases",
        "group": "com.xxx",
        "name": "xxxx",
        "version": "0.0.3.29.tom.9",
        "format": "maven2"
    } 
]
            
    for i in data:
        print("开始删除:" + i['name'] + "-" + i['version'])
        publish(i['id'])
        

第二个版本 v1.2

import json
import os
from requests import delete
import selenium
from selenium import webdriver
import pathlib
import time
from selenium.webdriver.common.keys import Keys

 
options = webdriver.ChromeOptions()
options.add_experimental_option("debuggerAddress", "127.0.0.1:9222")
driver = webdriver.Chrome(options = options)
 
 
def SLEEP(min=3):
    time.sleep(min) 
import shutil
def publish():   
    now_handle = driver.current_window_handle
    print(now_handle)
    SLEEP(2)
    driver.find_element_by_xpath('/html/body/div[1]/div/div/div[3]/div/div[2]/div/div/div/div/div[1]/div/div/div[1]/div/div/div/div/div/div[4]/div/div[2]/div[1]/div[2]/table[1]').click()
    SLEEP(3)
    driver.find_element_by_xpath('/html/body/div[1]/div/div/div[3]/div/div[2]/div/div/div/div/div[2]/div/div/div[1]/div/div/div/div/div/div[1]/div/div[2]/div/div/a[2]').click()    
    SLEEP(1)
    driver.find_element_by_xpath('//*[@id="button-1006-btnInnerEl"]').click()
    SLEEP(3) 


if __name__ == '__main__': 
    start_url = "http://XXXX:XX"  # 起始链接 包含要删除的列表
    driver.get(start_url)
    while True:
        publish()

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/840582.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号