#!/usr/bin/env python3
import sys
import requests

url = 'https://paste.opendev.org/json/'

# read input from stdin
input_str = sys.stdin.read()

# create data for new paste
data = {
    'language': '',
    'code': input_str,
    'private': False
}

# send request to create new paste
response = requests.post(url + '?method=pastes.newPaste', data=data)

# extract URL of newly created paste from response
paste_id = response.text.strip()
paste_url = f'https://paste.opendev.org/show/{paste_id}'

# print URL of newly created paste
print(paste_url)

