Exemplo n.º 1
0
    def get_page(self, url, k):
        ip = api.get_proxy()
        proxies = {"http:": str("http://" + str(ip))}

        headers = {
            "Cookie":
            "userDeviceType=pc",
            "Content-Type":
            "application/x-www-form-urlencoded; charset=UTF-8",
            "User-Agent":
            "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.80 Safari/537.36"
        }
        print(proxies)

        data = {
            "type_name": "3",
            "annstartdate_S": "2016-11-18",
            "annstartdate_E": "2019-11-18",
            "byf_page": k,
            "fun": "cggg"
        }

        try:
            page = requests.post(url,
                                 data=data,
                                 headers=headers,
                                 proxies=proxies)
            if page.status_code == 200:
                return page.json()
            else:
                print("访问URL失败!")
        except Exception as e:
            print(e)
Exemplo n.º 2
0
 def get_data_page(self, url):
     ip = api.get_proxy()
     proxies = {"http:": str("http://" + str(ip))}
     print(proxies)
     headers = {
         "Cookie":
         "JSESSIONID=B0491D841F79BBD9AE1616ECBE582F72; insert_cookie=83172026",
         "User-Agent":
         "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.80 Safari/537.36"
     }
     try:
         page = requests.get(url, headers=headers, proxies=proxies)
         if page.status_code == 200:
             return page
         else:
             print("The Error page's status_code is %s" % page.status_code)
     except Exception as e:
         print(e)
Exemplo n.º 3
0
def get_page(url):
    ip = api.get_proxy()
    proxies = {
        "http:": str("http://" + str(ip))
    }
    cookies_pool = [
        'clientlanguage=zh_CN; _gscu_1277169039=734418782e5a5y13; _gscbrs_1277169039=1; JSESSIONID=EF357A16AC7A01A2403D2D1350AF8EF4; _gscs_1277169039=t73471259hjdm1u14|pv:3',
        'clientlanguage=zh_CN; _gscu_1277169039=734418782e5a5y13; _gscbrs_1277169039=1; JSESSIONID=EF357A16AC7A01A2403D2D1350AF8EF4; _gscs_1277169039=t73471259hjdm1u14|pv:1'
        'clientlanguage=zh_CN; _gscu_1277169039=734418782e5a5y13; _gscbrs_1277169039=1; JSESSIONID=EF357A16AC7A01A2403D2D1350AF8EF4; _gscs_1277169039=t73471259hjdm1u14|pv:4',
        'JSESSIONID=5CA8366002EA83F2AF7CE402B500980E; clientlanguage=zh_CN; _gscu_1277169039=734719104w69nr75; _gscs_1277169039=73471910uevkfx75|pv:4; _gscbrs_1277169039=1'
        'JSESSIONID=5CA8366002EA83F2AF7CE402B500980E; clientlanguage=zh_CN; _gscu_1277169039=734719104w69nr75; _gscs_1277169039=73471910uevkfx75|pv:7; _gscbrs_1277169039=1'
    ]
    headers = {
        "Cookie": random.choice(cookies_pool)
        , "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:69.0) Gecko/20100101 Firefox/69.0"
    }
    print(proxies)
    page = requests.get(url, proxies=proxies, headers=headers)
    return page
Exemplo n.º 4
0
def get_page(p, url_base):
    ip = api.get_proxy()
    proxies = {"http:": str("http://" + str(ip))}
    cookies_pool = [
        "JSESSIONID=07ED51FF896B91B67295A08D1390D11E; JSESSIONID=2559C93BF631DA8BB83E38BE1526E73B",
        "JSESSIONID=25F0BB2841820ADE0C1C64455A7E730F; JSESSIONID=B47E922BFADF7043C43012DC19BF8812",
        "JSESSIONID=C15C0B57D2CB402EED8C625646FE06F9; JSESSIONID=A91BF8E16B7454D3C74D8BEA09834BF1"
    ]

    headers = {
        "Cookie":
        "JSESSIONID=7E6DCDFFAAA4B6FF862204E7A4230266; JSESSIONID=B47E922BFADF7043C43012DC19BF8812",
        "User-Agent":
        "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.80 Safari/537.36"
    }

    data = {
        'queryInfo.type': 'xmgg',
        'queryInfo.key': '',
        'queryInfo.jhhh': '',
        'queryInfo.gglx': '招标公告',
        'queryInfo.cglx': '',
        'queryInfo.cgfs': '',
        'queryInfo.qybm': '420001',
        'queryInfo.begin': '2018 / 11 / 12',
        'queryInfo.end': '2019 / 11 / 13',
        'queryInfo.pageNo': p,
        'queryInfo.pageSize': '15',
        'queryInfo.pageTotle': '610'
    }

    print(proxies)

    try:
        page = requests.post(url_base,
                             data=data,
                             headers=headers,
                             proxies=proxies)
        if page.status_code == 200:
            return page
    except Exception as e:
        print(e)
Exemplo n.º 5
0
def get_data_page(url):
    ip = api.get_proxy()
    proxies = {"http:": str("http://" + str(ip))}
    cookies_pool = [
        "2559C93BF631DA8BB83E38BE1526E73B", "C15C0B57D2CB402EED8C625646FE06F9",
        "JSESSIONID=B47E922BFADF7043C43012DC19BF8812"
    ]
    headers = {
        "Cookie":
        random.choice(cookies_pool),
        "User-Agent":
        "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:69.0) Gecko/20100101 Firefox/69.0"
    }
    print(proxies)
    try:
        page = requests.get(url, proxies=proxies, headers=headers)
        if page.status_code == 200:
            return page
    except Exception as e:
        print(e)
Exemplo n.º 6
0
 def get_data_page(self, url, tb_id, p_id):
     ip = api.get_proxy()
     proxies = {"http:": str("http://" + str(ip))}
     headers = {
         "Cookie":
         "userDeviceType=pc",
         "User-Agent":
         "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.80 Safari/537.36"
     }
     print(proxies)
     data = {"tb_id": tb_id, "p_id": p_id}
     try:
         page = requests.get(url,
                             params=data,
                             proxies=proxies,
                             headers=headers)
         if page.status_code == 200:
             return page
         else:
             print("访问单独URL失败!")
     except Exception as e:
         print(e)
Exemplo n.º 7
0
 def get_page(self, url, p):
     ip = api.get_proxy()
     proxies = {"http:": str("http://" + str(ip))}
     print(proxies)
     headers = {
         "Content-Type":
         "application/x-www-form-urlencoded",
         "Cookie":
         "JSESSIONID=36D8414E84F48944C936D76BEFA7353B; insert_cookie=83172026",
         "User-Agent":
         "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.80 Safari/537.36"
     }
     data = {"colcode": "0302", "curpage": p}
     try:
         page = requests.post(url,
                              proxies=proxies,
                              headers=headers,
                              data=data)
         if page.status_code == 200:
             return page
         else:
             print("访问主URL失败!")
     except Exception as e:
         print(e)
Exemplo n.º 8
0
 def get_ip(self):
     ip = api.get_proxy()
     return ip