Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Dorchies David
HaTaTA
Commits
bb92b322
Commit
bb92b322
authored
May 12, 2021
by
Dorchies David
Browse files
refactor: clean code
Refs
#1
parent
f675149a
Changes
5
Hide whitespace changes
Inline
Side-by-side
NAMESPACE
View file @
bb92b322
...
...
@@ -5,7 +5,7 @@ export(get_user_id)
export(jump_to_mon_calendrier)
export(jump_to_pointage)
export(login)
ex
port(
set_cookie
)
im
port(
magrittr
)
importFrom(httr,POST)
importFrom(httr,set_cookies)
importFrom(httr,user_agent)
R/add_temps.R
View file @
bb92b322
...
...
@@ -37,14 +37,13 @@ add_temps <- function(
POST
(
paste
(
cfg
$
url_post_add
,
cfg
$
param_add
,
sep
=
"?"
),
#user_agent(cfg$user_agent),
set_cookies
(
.cookies
=
cookies
),
body
=
list
(
date
=
date
,
type_regulation
=
type_regulation
,
commentaire
=
commentaire
,
user_id
=
attr
(
session
,
"user_id"
),
id_form
=
"
form_add
_regul"
,
id_form
=
cfg
$
form_add
,
duree
=
duree
)
)
...
...
R/set_cookie.R
deleted
100644 → 0
View file @
f675149a
#' Convert Cookie string into a key value [character] [vector]
#'
#' @param cookies [character] in format "Cookie: key1=value1; key2=value2..."
#'
#' @return Named [character] [vector] with cookies
#' @export
#'
#' @examples
#' set_cookie("Cookie: SERVERID=6df7a8ae; PHPSESSID=nvda6b0h1; OSCONTROL=u3bmeg9hjfvr5")
set_cookie
<-
function
(
cookies
)
{
if
(
substr
(
cookies
,
1
,
8
)
!=
"Cookie: "
)
{
stop
(
"`cookies` should be a string beginning by \"Cookie: \""
)
}
lCookies
<-
strsplit
(
strsplit
(
substring
(
cookies
,
9
),
"; "
)[[
1
]],
"="
)
vCookies
<-
sapply
(
lCookies
,
function
(
x
)
x
[
2
])
names
(
vCookies
)
<-
sapply
(
lCookies
,
function
(
x
)
x
[
1
])
class
(
vCookies
)
<-
c
(
"HatataCookie"
,
class
(
vCookies
))
return
(
vCookies
)
}
inst/config.yml
View file @
bb92b322
...
...
@@ -3,14 +3,4 @@ default:
url_pointage
:
https://temps-activites.inra.fr/temps/index.php?controller=Pointage/Feuille&action=showTempsTheorique&date_debut=%s&date_fin=%s&user_id=%s
url_post_add
:
https://temps-activites.inrae.fr/temps/index.php
param_add
:
controller=Regulation&action=add
user_agent
:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:88.0) Gecko/20100101 Firefox/88.0
headers
:
Accept
:
text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language
:
fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3
DNT
:
1
Connection
:
keep-alive
Upgrade-Insecure-Requests
:
1
headers_login
:
Content-Type
:
application/x-www-form-urlencoded
Origin
:
https://idp.inra.fr
Referer
:
https://idp.inra.fr/cas/login
form_add
:
form_add_regul
man/set_cookie.Rd
deleted
100644 → 0
View file @
f675149a
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/set_cookie.R
\name{set_cookie}
\alias{set_cookie}
\title{Convert Cookie string into a key value \link{character} \link{vector}}
\usage{
set_cookie(cookies)
}
\arguments{
\item{cookies}{\link{character} in format "Cookie: key1=value1; key2=value2..."}
}
\value{
Named \link{character} \link{vector} with cookies
}
\description{
Convert Cookie string into a key value \link{character} \link{vector}
}
\examples{
set_cookie("Cookie: SERVERID=6df7a8ae; PHPSESSID=nvda6b0h1; OSCONTROL=u3bmeg9hjfvr5")
}
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