mpaste/pastebins/paste_mozilla.py

17 lines
415 B
Python

import requests
def publish_to_mozilla(content):
url = 'https://pastebin.mozilla.org/api/'
data = {
'content': content,
'expires': '86400', # 24 hours
'format': 'text',
'lexer': '_text'
}
response = requests.post(url, data=data)
if response.status_code == 200:
# Mozilla returns full link to the paste
return f"{response.text}"
return None