Commit 340c944d authored by Łukasz Nowak's avatar Łukasz Nowak

recurls: Simplfy from recurlests

parent 2ed59df0
......@@ -23,11 +23,11 @@ from setuptools import setup, find_packages
setup(
name='recurlests',
name='recurls',
version='0.0.0',
author='Lukasz Nowak',
author_email='luke@nexedi.com',
description="Recurlests - requests like curl wrapper",
description="Recurls - requests like curl wrapper",
long_description=__doc__,
classifiers=[
'Environment :: Console',
......@@ -38,7 +38,7 @@ setup(
'later (GPLv3+)',
],
keywords='requests url curl',
url='https://lab.nexedi.com/luke/recurlests',
url='https://lab.nexedi.com/luke/recurls',
license='GPLv3+ with wide exception for FOSS',
install_requires=[
'requests', # for the great CaseInsensitiveDict
......@@ -50,7 +50,7 @@ setup(
package_dir={"": "src"},
entry_points={
'console_scripts': [
'recurl = recurlests.cli:runRecurl',
'recurl = recurls.cli:runRecurl',
]
},
)
import click
from pprint import pprint
from . import recurlests
from . import recurls
@click.command(short_help="Runs curl's wrapper recurl")
@click.option('--headers/--no-headers', help="Shows response headers", default=False, show_default=True)
......@@ -10,7 +10,7 @@ from . import recurlests
@click.option('--ip', help="IP to resolve to")
@click.argument("url")
def runRecurl(headers, output, curl, follow, ip, url):
mimikra = recurlests.Recurlests(curl)
mimikra = recurls.Recurls(curl)
response = mimikra.get(url, ip=ip, allow_redirects=follow)
print('Effective HTTP version:', response.effective_http_version)
print('Response status code:', response.status_code)
......
......@@ -7,7 +7,7 @@ import gzip
import os
class RecurlestsResponse(object):
class RecurlsResponse(object):
# properties:
# content Content of the response, in bytes.
# cookies A CookieJar of Cookies the server sent back.
......@@ -27,7 +27,7 @@ class RecurlestsResponse(object):
return json.loads(self.text, *args, **kwargs)
class Recurlests(object):
class Recurls(object):
"""curl command wrapper, mimicing requests"""
def __init__(self, curl='curl'):
self.curl = curl
......@@ -120,7 +120,7 @@ class Recurlests(object):
prc = subprocess.Popen(
command_list, stdout=subprocess.PIPE, stderr=subprocess.PIPE
)
response = RecurlestsResponse()
response = RecurlsResponse()
response.command_output, response.command_error = [
q.decode() for q in prc.communicate()]
response.command_returncode = prc.returncode
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment