ILYA_docs_RAG / pastebin_api.py
TheDavidYoungblood
99 additions of files in the repo, 99 additions of files...
8e70e09
raw
history blame contribute delete
No virus
1.04 kB
import os
import requests
from dotenv import load_dotenv
load_dotenv()
API_DEV_KEY = os.getenv('PASTEBIN_API_DEV_KEY')
def create_paste(api_paste_code, api_paste_name, api_paste_format, api_paste_private, api_paste_expire_date, api_user_key=''):
url = 'https://pastebin.com/api/api_post.php'
data = {
'api_dev_key': API_DEV_KEY,
'api_option': 'paste',
'api_paste_code': api_paste_code,
'api_paste_name': api_paste_name,
'api_paste_format': api_paste_format,
'api_paste_private': api_paste_private,
'api_paste_expire_date': api_paste_expire_date,
'api_user_key': api_user_key
}
response = requests.post(url, data=data)
return response.text
def get_user_key(api_user_name, api_user_password):
url = 'https://pastebin.com/api/api_login.php'
data = {
'api_dev_key': API_DEV_KEY,
'api_user_name': api_user_name,
'api_user_password': api_user_password
}
response = requests.post(url, data=data)
return response.text