| @@ 460-476 (lines=17) @@ | ||
| 457 | print(user+" Unfollowed") |
|
| 458 | time.sleep(3) |
|
| 459 | return True |
|
| 460 | def follow(username,password,id_list): |
|
| 461 | for user in id_list: |
|
| 462 | response = requests.put("https://api.github.com/user/following/" + user, auth=(username, password)) |
|
| 463 | status_code = int(response.status_code) |
|
| 464 | if status_code!=204: |
|
| 465 | if status_code==401: |
|
| 466 | print("[Error] Authentication Error") |
|
| 467 | return False |
|
| 468 | elif status_code==403: |
|
| 469 | print("[Error] Maximum number of login attempts exceeded") |
|
| 470 | sys.exit() |
|
| 471 | else: |
|
| 472 | print("[Error] in "+user+" follow!") |
|
| 473 | else: |
|
| 474 | print(user+" Followed") |
|
| 475 | time.sleep(3) |
|
| 476 | return True |
|
| 477 | def get_input(func_1=input,func_2=input): |
|
| 478 | tprint("git\nfollow") |
|
| 479 | username = func_1("Please Enter Your Github Username : ") |
|
| @@ 443-459 (lines=17) @@ | ||
| 440 | return [sorted(dif_list_1),sorted(dif_list_2)] |
|
| 441 | except Exception as ex: |
|
| 442 | print("[Error] dif function faild") |
|
| 443 | def unfollow(username,password,id_list): |
|
| 444 | for user in id_list: |
|
| 445 | response=requests.delete("https://api.github.com/user/following/" + user, auth=(username, password)) |
|
| 446 | status_code=int(response.status_code) |
|
| 447 | if status_code!=204: |
|
| 448 | if status_code==401: |
|
| 449 | print("[Error] Authentication Error") |
|
| 450 | return False |
|
| 451 | elif status_code==403: |
|
| 452 | print("[Error] Maximum number of login attempts exceeded") |
|
| 453 | sys.exit() |
|
| 454 | else: |
|
| 455 | print("[Error] in " + user + " unfollow!") |
|
| 456 | else: |
|
| 457 | print(user+" Unfollowed") |
|
| 458 | time.sleep(3) |
|
| 459 | return True |
|
| 460 | def follow(username,password,id_list): |
|
| 461 | for user in id_list: |
|
| 462 | response = requests.put("https://api.github.com/user/following/" + user, auth=(username, password)) |
|