· 6 years ago · Apr 10, 2020, 08:10 PM
1import requests
2
3key = 'api key'
4title = 'Posted with python code'
5message = 'This was posted with a python code'
6
7login_data = {
8 'api_dev_key': key,
9 'api_user_name': 'username',
10 'api_user_password': 'password'
11 }
12data = {
13 'api_option': 'paste',
14 'api_dev_key': key,
15 'api_paste_code': message,
16 'api_paste_name': title,
17 'api_paste_expire_date': 'N',
18 'api_user_key': None,
19 }
20
21lr = requests.post('https://pastebin.com/api/api_login.php', data=login_data)
22if lr.ok == True: print("Login Successful with key:")
23print(lr.text)
24data['api_user_key'] = lr.text
25
26r = requests.post('https://pastebin.com/api/api_post.php', data=data)
27if r.ok: print("Pasted!")