Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
recurls
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Łukasz Nowak
recurls
Commits
5bffc86c
Commit
5bffc86c
authored
Apr 05, 2023
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cli: By default do not follow redirects
parent
b415bd42
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
2 deletions
+5
-2
src/recurlests/cli.py
src/recurlests/cli.py
+3
-2
src/recurlests/recurlests.py
src/recurlests/recurlests.py
+2
-0
No files found.
src/recurlests/cli.py
View file @
5bffc86c
...
@@ -6,10 +6,11 @@ from . import recurlests
...
@@ -6,10 +6,11 @@ from . import recurlests
@
click
.
option
(
'--headers/--no-headers'
,
help
=
"Shows response headers"
,
default
=
False
,
show_default
=
True
)
@
click
.
option
(
'--headers/--no-headers'
,
help
=
"Shows response headers"
,
default
=
False
,
show_default
=
True
)
@
click
.
option
(
'--output/--no-output'
,
help
=
"Shows the output"
,
default
=
False
,
show_default
=
True
)
@
click
.
option
(
'--output/--no-output'
,
help
=
"Shows the output"
,
default
=
False
,
show_default
=
True
)
@
click
.
option
(
'--curl'
,
help
=
"Path to curl binary"
,
default
=
'curl'
,
show_default
=
True
)
@
click
.
option
(
'--curl'
,
help
=
"Path to curl binary"
,
default
=
'curl'
,
show_default
=
True
)
@
click
.
option
(
'--follow/--no-follow'
,
help
=
"Follows redirects"
,
default
=
False
,
show_default
=
True
)
@
click
.
argument
(
"url"
)
@
click
.
argument
(
"url"
)
def
runRecurl
(
headers
,
output
,
curl
,
url
):
def
runRecurl
(
headers
,
output
,
curl
,
follow
,
url
):
mimikra
=
recurlests
.
Recurlests
(
curl
)
mimikra
=
recurlests
.
Recurlests
(
curl
)
response
=
mimikra
.
get
(
url
)
response
=
mimikra
.
get
(
url
,
allow_redirects
=
follow
)
print
(
'Effective HTTP version:'
,
response
.
effective_http_version
)
print
(
'Effective HTTP version:'
,
response
.
effective_http_version
)
print
(
'Response status code:'
,
response
.
status_code
)
print
(
'Response status code:'
,
response
.
status_code
)
print
(
'Response status:'
,
response
.
ok
and
"ok"
or
"error"
)
print
(
'Response status:'
,
response
.
ok
and
"ok"
or
"error"
)
...
...
src/recurlests/recurlests.py
View file @
5bffc86c
...
@@ -125,6 +125,8 @@ class Recurlests(object):
...
@@ -125,6 +125,8 @@ class Recurlests(object):
response
.
headers
=
CaseInsensitiveDict
()
response
.
headers
=
CaseInsensitiveDict
()
for
line
in
response
.
header_text
.
splitlines
()[
1
:]:
for
line
in
response
.
header_text
.
splitlines
()[
1
:]:
if
line
.
strip
():
if
line
.
strip
():
if
':'
not
in
line
:
continue
header
,
value
=
line
.
split
(
':'
,
1
)
header
,
value
=
line
.
split
(
':'
,
1
)
value
=
value
.
strip
()
value
=
value
.
strip
()
response
.
headers
.
setdefault
(
header
,
[])
response
.
headers
.
setdefault
(
header
,
[])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment