0
点赞
收藏
分享

微信扫一扫

Python自动化测试requests库深度详解

package com.zhuguohui.app.lib.tools;

/**
 * Created by zhuguohui
 * Date: 2024/6/1
 * Time: 13:39
 * Desc:获取随机图片
 */
public class RandomImage {

//    static final String url= "https://picsum.photos/%d/%d?random=%d";
    static final String url= "https://source.unsplash.com/%dx%d/?beauty&random=%d";


    public static String get(int width,int height){
        return String.format(url,width,height,(int)(Math.random()*100));
    }
}

上面的代码可以生成随机图片。而且内容可以指定 **“https://source.unsplash.com/%dx%d/?beauty&random=%d”**比如?后面的beauty返回的就是美女图片

效果

在这里插入图片描述

举报

相关推荐

python自动化的requests

0 条评论