Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pymoondb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alessandro Frigeri
pymoondb
Commits
57a85b83
Commit
57a85b83
authored
6 years ago
by
Alessandro Frigeri
Browse files
Options
Downloads
Patches
Plain Diff
fatto
parent
800e85dd
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
moondb.py
+22
-1
22 additions, 1 deletion
moondb.py
with
22 additions
and
1 deletion
moondb.py
+
22
−
1
View file @
57a85b83
...
@@ -43,10 +43,11 @@ def get_missions():
...
@@ -43,10 +43,11 @@ def get_missions():
missions
=
[]
missions
=
[]
resp
=
requests
.
get
(
_url
(
'
/authorities/missions/
'
))
resp
=
requests
.
get
(
_url
(
'
/authorities/missions/
'
))
_check_resp
(
resp
)
_check_resp
(
resp
)
print
resp
.
json
()[
'
result
'
]
for
m_item
in
resp
.
json
()[
'
result
'
]:
for
m_item
in
resp
.
json
()[
'
result
'
]:
missions
.
append
(
Mission
(
m_item
[
'
name
'
]
))
missions
.
append
(
Mission
(
m_item
[
'
name
'
]
))
print
(
m_item
)
print
(
m_item
)
this_m
=
json
.
load
s
(
"
{
'
name
'
:
'
Apollo 11
'
}
"
)
#
this_m = json.load( "{'name': 'Apollo 11'}" )
return
missions
return
missions
def
get_missions2
():
def
get_missions2
():
...
@@ -65,6 +66,18 @@ def get_samplingtechnique():
...
@@ -65,6 +66,18 @@ def get_samplingtechnique():
class
Filter
:
class
Filter
:
def
__init__
(
self
):
def
__init__
(
self
):
self
.
mission
=
None
self
.
mission
=
None
self
.
landmark
=
None
self
.
specimenType
=
None
self
.
samplingTechnique
=
None
self
.
analyzedMaterial
=
None
self
.
analyte
=
None
self
.
analysisMethod
=
None
def
_toJSON
(
self
):
return
json
.
dumps
(
self
,
default
=
lambda
o
:
o
.
__dict__
,
sort_keys
=
True
,
indent
=
4
)
def
get_results
(
self
):
print
self
.
_toJSON
()
resp
=
requests
.
get
(
_url
(
'
/data/
'
+
self
.
_toJSON
()
))
class
Mission
:
class
Mission
:
...
@@ -85,3 +98,11 @@ class Analyte:
...
@@ -85,3 +98,11 @@ class Analyte:
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
m
=
get_missions
()
m
=
get_missions
()
print
m
print
m
f
=
Filter
()
f
.
mission
=
[
"
Apollo 11
"
]
f
.
specimenType
=
[
"
Breccia
"
]
#print f.toJSON()
print
f
.
get_results
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment