在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/Python/ 為啥說get_ip_content 沒有定義

為啥說get_ip_content 沒有定義

from get_ip import *

 response=requests.get(url=url,headers=headers,cookies=self.cookies,proxies=get_ip_content())


get_ip 類是這樣的
#!/usr/bin env python3
import requests
import re
import random
def get_ip_content():
  response=requests.get('http://www.httpipqq.com/api.asp?sl=10&noinfo=true&ddbh=189483614300055720')
  ip_list=re.findall('(\d+\.+\d+\.+\d+\.\d+:\d+)', response.text, re.S)
  PROXIES = {
         "http": "http://"+ip_list[random.randint(0,len(ip_list))],
    "https": "http://"+ip_list[random.randint(0,len(ip_list))],
    }

  return PROXIES

下面這樣寫報錯?
Traceback (most recent call last):
File "wechat_official_accounts.py", line 85, in <module>

wechat_offical_account().get_offical_account()

File "wechat_official_accounts.py", line 36, in get_offical_account

response=requests.get(url=url,headers=headers,cookies=self.cookies,proxies=get_ip_content())

NameError: name 'get_ip_content' is not defined
為啥說我get_ip_content

回答
編輯回答
涼薄

直接導入get_ip,用包名加函數(shù)名來調(diào)用。

import get_ip
get_ip.get_ip_content()
2018年7月25日 14:45
編輯回答
假灑脫

這樣寫的確報錯

get_ip.get_ip_content()
# 了解一下
2017年5月3日 05:27