Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
isidore
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
crawlers
isidore
Commits
884906b4
Commit
884906b4
authored
Jun 14, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] (Still bug with Author search) + easy search function + doc.cabal.
parent
3b06f228
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
55 additions
and
27 deletions
+55
-27
Main.hs
app/Main.hs
+1
-3
crawlerIsidore.cabal
crawlerIsidore.cabal
+30
-5
package.yaml
package.yaml
+4
-4
ISIDORE.hs
src/ISIDORE.hs
+13
-0
Client.hs
src/ISIDORE/Client.hs
+7
-9
Lib.hs
src/Lib.hs
+0
-6
No files found.
app/Main.hs
View file @
884906b4
{-# LANGUAGE OverloadedStrings #-}
module
Main
where
import
Lib
import
ISIDORE.Client
import
Network.HTTP.Client
(
newManager
)
import
Network.HTTP.Client.TLS
(
tlsManagerSettings
)
...
...
@@ -12,8 +11,7 @@ main = do
manager'
<-
newManager
tlsManagerSettings
res
<-
runClientM
(
search
(
Just
1
)
(
Just
JSON
)
(
Just
10
)
(
Just
"poison"
)
(
Nothing
))
(
mkClientEnv
manager'
$
BaseUrl
Https
"api.isidore.science"
443
"resource"
)
...
...
crawlerIsidore.cabal
View file @
884906b4
...
...
@@ -2,7 +2,7 @@
--
-- see: https://github.com/sol/hpack
--
-- hash:
81cc2f638a0cccea3e393883a34212b675a830c7654ae029d01acc5e922f87c0
-- hash:
f8c91a232670fcf66018c2dc22039b92e3caf411691f9c10100f31a4337dc13d
name: crawlerIsidore
version: 0.1.0.0
...
...
@@ -26,13 +26,22 @@ source-repository head
library
exposed-modules:
Lib
ISIDORE
ISIDORE.Client
other-modules:
Paths_crawlerIsidore
hs-source-dirs:
src
build-depends:
base >=4.7 && <5
aeson
, base >=4.7 && <5
, bytestring
, http-client
, http-client-tls
, http-media
, servant
, servant-client
, text
default-language: Haskell2010
executable crawlerIsidore-exe
...
...
@@ -43,8 +52,16 @@ executable crawlerIsidore-exe
app
ghc-options: -threaded -rtsopts -with-rtsopts=-N
build-depends:
base >=4.7 && <5
aeson
, base >=4.7 && <5
, bytestring
, crawlerIsidore
, http-client
, http-client-tls
, http-media
, servant
, servant-client
, text
default-language: Haskell2010
test-suite crawlerIsidore-test
...
...
@@ -56,6 +73,14 @@ test-suite crawlerIsidore-test
test
ghc-options: -threaded -rtsopts -with-rtsopts=-N
build-depends:
base >=4.7 && <5
aeson
, base >=4.7 && <5
, bytestring
, crawlerIsidore
, http-client
, http-client-tls
, http-media
, servant
, servant-client
, text
default-language: Haskell2010
package.yaml
View file @
884906b4
name
:
crawlerIsidore
version
:
0.1.0.0
github
:
"
git
hubuser
/crawlerIsidore"
github
:
"
git
lab.iscpif.fr/gargantext/crawlers
/crawlerIsidore"
license
:
BSD3
author
:
"
Author
name
here
"
maintainer
:
"
example@example.com
"
copyright
:
"
2019
Author
name
here
"
author
:
"
CNRS/IMT
"
maintainer
:
"
contact@gargantext.org
"
copyright
:
"
2019
CNRS/IMT
"
extra-source-files
:
-
README.md
...
...
src/ISIDORE.hs
0 → 100644
View file @
884906b4
{-# LANGUAGE OverloadedStrings #-}
module
ISIDORE
where
import
ISIDORE.Client
import
Network.HTTP.Client
(
newManager
)
import
Network.HTTP.Client.TLS
(
tlsManagerSettings
)
import
Servant.Client
-- crawler :: IO ()
crawler
n
q
a
=
do
manager'
<-
newManager
tlsManagerSettings
runClientM
(
search
n
q
a
)
(
mkClientEnv
manager'
$
BaseUrl
Https
"api.isidore.science"
443
"resource"
)
src/ISIDORE/Client.hs
View file @
884906b4
...
...
@@ -9,6 +9,7 @@ module ISIDORE.Client where
import
Servant.API
import
Servant.Client
import
GHC.Generics
(
Generic
)
import
Data.Proxy
(
Proxy
(
..
))
import
Data.ByteString.Lazy
(
ByteString
)
import
Data.Aeson
...
...
@@ -22,9 +23,7 @@ data LocalContent = LocalContent
deriving
(
Show
)
instance
FromJSON
LocalContent
where
parseJSON
(
Object
o
)
=
LocalContent
<$>
(
o
.:
"@xml:lang"
)
<*>
(
o
.:
"$"
)
parseJSON
(
Object
o
)
=
LocalContent
<$>
(
o
.:
"@xml:lang"
)
<*>
(
o
.:
"$"
)
data
Author
=
Author
{
...
...
@@ -34,13 +33,12 @@ data Author = Author
deriving
(
Show
)
instance
FromJSON
Author
where
parseJSON
(
Object
o
)
=
Author
<$>
(
o
.:
"firstName"
)
<*>
(
o
.:
"lastName"
)
parseJSON
(
Object
o
)
=
Author
<$>
(
o
.:
"firstName"
)
<*>
(
o
.:
"lastName"
)
data
MayBeLocal
=
Local
LocalContent
|
NonLocal
T
.
Text
deriving
(
Show
)
deriving
(
Show
,
Generic
)
instance
FromJSON
MayBeLocal
data
IsidoreDoc
=
IsidoreDoc
{
...
...
@@ -79,6 +77,6 @@ type Search = "search"
isidoreAPI
::
Proxy
ISIDOREAPI
isidoreAPI
=
Proxy
search
::
Maybe
Int
->
Maybe
Output
->
Maybe
T
.
Text
->
Maybe
T
.
Text
->
ClientM
T
.
Text
search
::
Maybe
Int
->
Maybe
T
.
Text
->
Maybe
T
.
Text
->
ClientM
T
.
Text
search
n
q
a
=
client
isidoreAPI
n
(
Just
JSON
)
q
a
search
=
client
isidoreAPI
src/Lib.hs
deleted
100644 → 0
View file @
3b06f228
module
Lib
(
someFunc
)
where
someFunc
::
IO
()
someFunc
=
putStrLn
"someFunc"
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