Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
La Quadrature du Net
rpteam
wantzel
Commits
5d946fff
Commit
5d946fff
authored
Aug 03, 2019
by
Mindiell
Browse files
Ok, testing return code for API is fixed (2)
parent
7c96c2b8
Changes
1
Hide whitespace changes
Inline
Side-by-side
rp.py
View file @
5d946fff
...
...
@@ -338,7 +338,6 @@ class Rp():
# Do the same for new RP
Log
.
debug
(
"Adding article to new RP"
)
headers
=
{
"Authorization"
:
config
.
token
}
data
=
{
"url"
:
url
,
"speak"
:
True
if
"c"
in
command
else
False
,
...
...
@@ -346,11 +345,15 @@ class Rp():
"quote"
:
True
if
command
.
count
(
"p"
)
>
1
else
False
,
}
Log
.
debug
(
data
)
result
=
requests
.
post
(
"%s/articles/"
%
config
.
api
,
data
=
data
,
headers
=
headers
)
try
:
result
=
requests
.
post
(
"%s/articles/"
%
config
.
api
,
data
=
data
,
headers
=
{
"Authorization"
:
config
.
token
},
)
except
Exception
as
e
:
Log
.
error
(
"Erreur lors de l'appel à l'API : "
+
str
(
e
))
Log
.
debug
(
result
.
status_code
)
if
result
.
status_code
>=
200
and
result
.
status_code
<
300
:
article
=
json
.
loads
(
result
.
text
)
note
=
article
[
"score"
]
...
...
Write
Preview
Supports
Markdown
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