I'm trying to paste from my python script using following snippet:
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. 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!
Your code is fine and works perfectly on mine too with my own 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.
Lastly, as mentioned here , try doing an HTTPS
request, and see if that fixes it.
Solved, pastebin was on maintenance, and only accepted https request
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.