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
8c6e7352
Commit
8c6e7352
authored
Jul 23, 2024
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
backup
parent
1797eb42
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
13 deletions
+17
-13
setup.py
setup.py
+3
-0
src/recurls/__init__.py
src/recurls/__init__.py
+1
-1
src/recurls/recurls.py
src/recurls/recurls.py
+13
-12
No files found.
setup.py
View file @
8c6e7352
...
...
@@ -48,6 +48,9 @@ setup(
python_requires
=
">=3.5"
,
packages
=
find_packages
(
"src"
),
package_dir
=
{
""
:
"src"
},
extras_require
=
{
"dev"
:
[
"pytest"
,
"pyflakes"
,
"mock"
]
},
entry_points
=
{
'console_scripts'
:
[
'recurl = recurls.cli:runRecurl'
,
...
...
src/recurls/__init__.py
View file @
8c6e7352
from
.recurls
import
Recurls
from
.recurls
import
Recurls
,
RecurlsResponse
src/recurls/recurls.py
View file @
8c6e7352
...
...
@@ -38,6 +38,16 @@ class Recurls(object):
def
put
(
self
,
url
,
**
kwargs
):
return
self
.
request
(
'PUT'
,
url
,
**
kwargs
)
def
_call_curl
(
self
,
command_list
):
prc
=
subprocess
.
Popen
(
command_list
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
response
=
RecurlsResponse
()
response
.
command_output
,
response
.
command_error
=
[
q
.
decode
()
for
q
in
prc
.
communicate
()]
response
.
command_returncode
=
prc
.
returncode
return
response
def
request
(
self
,
method
,
...
...
@@ -117,17 +127,8 @@ class Recurls(object):
'--connect-timeout'
,
str
(
timeout
[
0
]),
'--max-time'
,
str
(
timeout
[
1
])])
command_list
.
append
(
url
)
prc
=
subprocess
.
Popen
(
command_list
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
)
response
=
RecurlsResponse
()
response
.
command_output
,
response
.
command_error
=
[
q
.
decode
()
for
q
in
prc
.
communicate
()]
response
.
command_returncode
=
prc
.
returncode
try
:
response
.
write_out_json
=
json
.
loads
(
response
.
command_output
)
except
Exception
:
raise
response
=
self
.
_call_curl
(
command_list
)
response
.
write_out_json
=
json
.
loads
(
response
.
command_output
)
with
open
(
response_header_file
)
as
fh
:
response
.
header_text
=
fh
.
read
()
response
.
headers
=
CaseInsensitiveDict
()
...
...
@@ -184,7 +185,7 @@ class Recurls(object):
response
.
time_starttransfer
=
response
.
write_out_json
[
'time_starttransfer'
]
response
.
time_total
=
response
.
write_out_json
[
'time_total'
]
response
.
elapsed
=
float
(
response
.
time_total
)
response
.
elapsed
=
response
.
time_total
response
.
url
=
response
.
write_out_json
[
'url'
]
response
.
url_effective
=
response
.
write_out_json
[
'url_effective'
]
response
.
urlnum
=
response
.
write_out_json
[
'urlnum'
]
...
...
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