python - python代码在运行时不会打印任何东西
问题描述
我正在尝试制作一些东西,将我所有的不和谐用户令牌放入 tokens.txt,然后告诉我它们是否是有效的用户令牌。但是,它从不打印任何内容,只是退出。如果有人知道如何解决这个问题,请告诉我。
import requests
with open("tokens.txt","r+") as f:
for line in f:
token=line.strip("\n")
headers = {'Content-Type': 'application/json', 'authorization': token}
url = "https://discordapp.com/api/v6/users/@me/library"
if r.status_code == 200:
print(token+" is valid")
else:
print("invalid token found~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
我已经尝试过几次
$ python3 tokenfilter.py
$ python3 tokenfilter.py
$
解决方案
你不提出任何要求。您应该添加如下内容:
r = requests.get(url, headers=headers)
推荐阅读
- swift - 如何在 Swift Playgrounds 中获得弹出对话框
- php - 如何合并jpeg图像
- javascript - 每次在 JavaScript 中调用函数时分别保存函数的结果
- html - 下拉菜单 css BEM 概念的 Html 标记
- powershell - PS Invoke-RestMethod:远程服务器返回错误:(500)内部服务器错误
- angular - NgStyle 未在可观察的完整回调中更新
- reactjs - 当前 url=link 到 react-router-dom 时如何将类添加到导航
- javascript - 防止<>将tinymce解析为>
- function - 如何实现异步调用堆栈
- r - 从卡方分布创建向量 x