Reputation: 3
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.
Upvotes: 0
Views: 2295
Reputation: 3
Solved, pastebin was on maintenance, and only accepted https request
Upvotes: 0
Reputation: 7744
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.
Upvotes: 0