have planet orders request take in a series of item descriptions to create an order
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 42/100
Línea de trabajo
Start at the planet orders request CLI entry point and inspect cli/types.py, especially the existing JSON parameter handling. Use the shown planet data search pipeline as the input case and verify that IDs and newline-delimited item descriptions are accepted, while mixed item types fail and item type remains required for ID input.】【。
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
To support the common use case of creating an order from a search, have planet orders request take in a series of item descriptions to create an order.
Usage:
planet data search --limit 5 PSScene | planet orders request - --name test --clip aoi.geojson --bundle analytic
Implementation notes: ids and item type are taken from the input. There is a check for more than one item type, which at this point results in a failure (the ability to order multiple types could come in a future improvement)
Changes required:
- planet order requests must now allow multiline input where each line is json in addition to ids as the argument
- item-type is only required if the input is IDs
Below is a working example of extracting item type and id from the output of planet data search.
$> planet data search --limit 5 PSScene | python ml.py --items -
PSScene: 20230504_155548_86_24b9
PSScene: 20230504_134550_99_2251
PSScene: 20230504_052537_02_2465
PSScene: 20230504_043314_80_248b
PSScene: 20230504_161301_74_2405
Note: MultiJSON is a hacked up version of JSON, which is in the cli/types.py module. There is more work here in defining a type that can handle both comma separated strings and multiple lines of json.
ml.py
import json
import click
class MultiJSON(click.ParamType):
name = 'MultiJSON'
def convert(self, value, param, ctx) -> list:
if isinstance(value, list):
conv = value
else:
# read from raw json
# skip this if value is a Path object or something else
if isinstance(value, str) and (value.startswith('{')
or value.startswith('[')):
print('hereh')
try:
conv = json.loads(value)
if isinstance(conv, dict):
conv = [conv]
except json.decoder.JSONDecodeError:
self.fail(
'JSON string is not valid JSON. Make sure the entire '
'JSON string is single-quoted and string entries are '
'double-quoted.')
# read from stdin or file
else:
try:
with click.open_file(value) as f:
conv = [json.loads(line) for line in f if line]
except FileNotFoundError:
self.fail('File not found.')
except json.decoder.JSONDecodeError:
stream = 'stdin' if value == '-' else 'JSON file'
self.fail(f'{stream} does not contain valid JSON.')
if not len(conv):
self.fail('JSON cannot be empty.')
return conv
@click.command()
@click.option('--items', type=MultiJSON(), required=True)
def hello(items):
for i in items:
click.echo(f"{i['properties']['item_type']}: {i['id']}")
if __name__ == '__main__':
hello()
- Lenguaje dominante
- Python
- Estrellas
- 300
- Forks
- 99
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de planetlabs/planet-client-python
-
better-testing
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
planetlabs/planet-client-python#1110 ·
-
FeaturesClient list_items does not support filteringPosiblemente ocupada @steps-re la tomó hace 97 días. Abiertoproposal
Dificultad 3/5 1-2 días Aptitud para principiantes 65/100
planetlabs/planet-client-python#1221 ·
-
FeaturesClient does not implement Update FeaturePosiblemente ocupada @tbarsballe la tomó hace 126 días. Abiertoproposal
Dificultad 3/5 1-2 días Aptitud para principiantes 57/100
planetlabs/planet-client-python#1214 ·
-
bug
Dificultad 3/5 1-2 días Aptitud para principiantes 48/100
planetlabs/planet-client-python#1197 · 1 comentario · 1 reacción ·
-
Quota APIQuizá libre de nuevo @asonnenschein la tomó hace 425 días y no hay ningún pull request abierto. Abiertoai-claude
planetlabs/planet-client-python#1191 · 1 comentario · 1 asignado ·
Todos los issues de planetlabs/planet-client-python
Issues similares
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100
gradio-app/gradio#13964 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 93/100
BSData/horus-heresy-3rd-edition#3232 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
jbacalso24/mimry#123 ·
Los mantenedores suelen responder en 1 día
-
p:3-mid pydanty:bug pydanty:is-working
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
pydantic/pydantic-ai#10153 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
good first issue priority: medium size: S testing
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
cubrid-lab/cubrid-cookbook-python#316 ·
Los mantenedores suelen responder en 1 día