2016-12-27 33 views
-2

我剛纔下載instabot但是當我試圖執行它,我看到了一些錯誤,這是主要的模塊(「example.py」),有源碼:什麼是錯誤的這一Python代碼

#!/usr/bin/env python 
# -*- coding: utf-8 -*- 
import sys, os 
sys.path.append(os.path.join(sys.path[0],'src')) 

from instabot import InstaBot 
from check_status import check_status 
from feed_scanner import feed_scanner 
from unfollow_protocol import unfollow_protocol 
from follow_protocol import follow_protocol 
import time 


bot = InstaBot(login="username", password="password", 
       like_per_day=1000, 
       comments_per_day=0, 
       tag_list=['follow4follow', 'f4f', 'cute'], 
       tag_blacklist=['rain', 'thunderstorm'], 
       user_blacklist={}, 
       max_like_for_one_tag=50, 
       follow_per_day=300, 
       follow_time=1*60, 
       unfollow_per_day=300, 
       unfollow_break_min=15, 
       unfollow_break_max=30, 
       log_mod=0, 
       proxy='', 
       # Use unwanted username list to block users which have username contains one of this string 
       ## Doesn't have to match entirely example: mozart will be blocked because it contains *art 
       ### freefollowers will be blocked because it contains free 
       unwanted_username_list=['second','stuff','art','project','love','life','food','blog','free','keren','photo','graphy','indo', 
             'travel','art','shop','store','sex','toko','jual','online','murah','jam','kaos','case','baju','fashion', 
             'corp','tas','butik','grosir','karpet','sosis','salon','skin','care','cloth','tech','rental', 
             'kamera','beauty','express','kredit','collection','impor','preloved','follow','follower','gain', 
             '.id','_id','bags']) 
while True: 

    #print("# MODE 0 = ORIGINAL MODE BY LEVPASHA") 
    #print("## MODE 1 = MODIFIED MODE BY KEMONG") 
    #print("### MODE 2 = ORIGINAL MODE + UNFOLLOW WHO DON'T FOLLOW BACK") 
    #print("#### MODE 3 = MODIFIED MODE : UNFOLLOW PEOPLE WHO DON'T FOLLOW BACK BASED ON RECENT FEED ONLY") 
    #print("##### MODE 4 = MODIFIED MODE : FOLLOW PEOPLE BASED ON RECENT FEED ONLY") 
    #print("###### MODE 5 = MODIFIED MODE : JUST UNFOLLOW EVERYBODY, EITHER YOUR FOLLOWER OR NOT") 

    ################################ 
      ## WARNING ### 
    ################################ 

    # DON'T USE MODE 5 FOR A LONG PERIOD. YOU RISK YOUR ACCOUNT FROM GETTING BANNED 
    ## USE MODE 5 IN BURST MODE, USE IT TO UNFOLLOW PEOPLE AS MANY AS YOU WANT IN SHORT TIME PERIOD 

    mode = 0 

    #print("You choose mode : %i" %(mode)) 
    #print("CTRL + C to cancel this operation or wait 30 seconds to start") 
    #time.sleep(30) 

    if mode == 0 : 
     bot.new_auto_mod() 

    elif mode == 1 : 
     check_status(bot) 
     while bot.self_following - bot.self_follower > 200: 
      unfollow_protocol(bot) 
      time.sleep(10*60) 
      check_status(bot) 
     while bot.self_following - bot.self_follower < 400: 
      while len(bot.user_info_list) <50 : 
       feed_scanner(bot) 
       time.sleep(5*60) 
       follow_protocol(bot) 
       time.sleep(10*60) 
       check_status(bot) 

    elif mode == 2 : 
     bot.bot_mode = 1 
     bot.new_auto_mod() 

    elif mode == 3 : 
     unfollow_protocol(bot) 
     time.sleep(10*60) 

    elif mode == 4 : 
     feed_scanner(bot) 
     time.sleep(60) 
     follow_protocol(bot) 
     time.sleep(10*60) 

    elif mode == 5 : 
     bot.bot_mode=2 
     unfollow_protocol(bot) 

    else : 
     print ("Wrong mode!") 

當我啓動它,我看到這些錯誤:

Trying to login as username... 

Traceback (most recent call last): 
    File "example.py", line 35, in <module> 
    '.id','_id','bags']) 
    File "/home/mohand/Desktop/instabot.py-master/src/instabot.py", line 185, in __init__ 
    self.login() 
    File "/home/mohand/Desktop/instabot.py-master/src/instabot.py", line 224, in login 
    r = self.s.get(self.url) 
    File "/home/mohand/.local/lib/python2.7/site-packages/requests/sessions.py", line 501, in get 
    return self.request('GET', url, **kwargs) 
    File "/home/mohand/.local/lib/python2.7/site-packages/requests/sessions.py", line 488, in request 
    resp = self.send(prep, **send_kwargs) 
    File "/home/mohand/.local/lib/python2.7/site-packages/requests/sessions.py", line 609, in send 
    r = adapter.send(request, **kwargs) 
    File "/home/mohand/.local/lib/python2.7/site-packages/requests/adapters.py", line 423, in send 
    timeout=timeout 
    File "/home/mohand/.local/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 594, in urlopen 
    chunked=chunked) 
    File "/home/mohand/.local/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 350, in _make_request 
    self._validate_conn(conn) 
    File "/home/mohand/.local/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 835, in _validate_conn 
    conn.connect() 
    File "/home/mohand/.local/lib/python2.7/site-packages/requests/packages/urllib3/connection.py", line 330, in connect 
    cert = self.sock.getpeercert() 
    File "/home/mohand/.local/lib/python2.7/site-packages/requests/packages/urllib3/contrib/pyopenssl.py", line 324, in getpeercert 
    'subjectAltName': get_subj_alt_name(x509) 
    File "/home/mohand/.local/lib/python2.7/site-packages/requests/packages/urllib3/contrib/pyopenssl.py", line 171, in get_subj_alt_name 
    ext = cert.extensions.get_extension_for_class(
AttributeError: 'Extensions' object has no attribute 'get_extension_for_class' 

我使用python 3.5請我需要幫助:)

+0

首先的問題,我所看到的是'unwanted_username_list' – TheLazyScripter

+0

@TheLazyScripter \t沒有結束這是正確的,即使我認爲這是一個錯誤的浮動括號。但這是一個功能的論點。我認爲問題在於登錄。 – MYGz

+0

好的,我該怎麼辦? – Mohand

回答

2

您可能需要升級加密的版本。檢查here的詳細信息,這個問題

0

試試這個:

sudo pip install cryptography --upgrade