封装与调用

__init__参数传递,url提取

import requests
import re

class Test():

    def __init__(self,s):
        self.s = s

    def bb(self,url):
        r=self.s = s.get(url,verify=False)
        print(r.text)

if __name__ == '__main__':
    s = requests.session()
    aa = Test(s)
    url = "https://jctcg.9caitong.com/"
    aa.bb(url)

  

 

 

 

posted @ 2018-04-23 10:20  章豹  阅读(119)  评论(0编辑  收藏  举报