You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi I would like to take a stab at this.
looking at the code
@line_magic
def pastebin(self, parameter_s=''):
"""Upload code to dpaste.com, returning the URL.
Usage:\\
%pastebin [-d "Custom description"] 1-7
The argument can be an input history range, a filename, or the name of a
string or macro.
Options:
-d: Pass a custom description. The default will say
"Pasted from IPython".
"""
opts, args = self.parse_options(parameter_s, 'd:')
try:
code = self.shell.find_user_code(args)
except (ValueError, TypeError) as e:
print(e.args[0])
return
post_data = urlencode(
{
"title": opts.get("d", "Pasted from IPython"),
"syntax": "python",
"content": code,
}
).encode("utf-8")
request = Request(
"http://dpaste.com/api/v2/",
headers={"User-Agent": "IPython v{}".format(version)},
)
response = urlopen(request, post_data)
return response.headers.get('Location')
the http is hard coded into endpoint of dpaste.com/api/v2/ in the code.
just changing http to https worked fine in my quick testing.
just wanted to ask, should opting for http or https be based on some parameter instead rather hardcoding the url.
Steps to reproduce
%pastebin 1
Expected result
An HTTPS link to the paste result is returned
Actual result
An HTTP link to the paste result is returned
System info
Manjaro Linux, Python 3.9.4, IPython 7.22.0 (reproduces on IPython 8.0.0.dev)
The text was updated successfully, but these errors were encountered: