简体   繁体   English

pastebin api:无效的 api_dev_key

[英]pastebin api : invalid api_dev_key

I'm trying to paste from my python script using following snippet:我正在尝试使用以下代码段从我的 python 脚本中粘贴:

import requests
API_ENDPOINT = "http://pastebin.com/api/api_post.php"

data = {'api_dev_key':'my key',
        'api_option': 'paste',
        'api_paste_code': 'hola',
        'api_paste_expire_date':'10M'
}


r = requests.post(url = API_ENDPOINT, data = data)
print(r)
print(r.text)

Which worked well after a few days, but now it returns bad request, invalid api_dev_key.几天后效果很好,但现在它返回错误的请求,无效的 api_dev_key。 I can't find where is the problem and I tried with another account's key.我找不到问题出在哪里,我尝试使用另一个帐户的密钥。

Try changing the HTTP to HTTPS , i think that should do it!尝试将HTTP更改为HTTPS ,我认为应该这样做!

Your code is fine and works perfectly on mine too with my own data .您的代码很好,并且在我自己的data上也可以完美运行。 Ensure that your account is active and has no warning for any verification.确保您的帐户处于活动状态并且没有任何验证警告。

You can simply try changing the api_dev_key to an acceptable value in pastebin.com.conf and see if it fixes the issue.您可以简单地尝试在api_dev_key更改为可接受的值,看看它是否能解决问题。

Lastly, as mentioned here , try doing an HTTPS request, and see if that fixes it.最后,如此所述,尝试执行HTTPS请求,看看是否可以解决问题。

Solved, pastebin was on maintenance, and only accepted https request解决了,pastebin在维护,只接受https请求

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM