Portal    Foro    Buscar    FAQ    Registrarse    Conectarse


Publicar nuevo tema  Responder al tema 
Página 2 de 2
Ir a la página Anterior  1, 2
 
[SOLUCIONADO] API AEMET
Autor Mensaje
Responder citando   Descargar mensaje  
Mensaje Re: API AEMET 
 
Jajaja, Tincho, algo parecido, aunque soy yo de más blancogás que de cañas o birras. En realidad, es para los amigos de la Asociación Daimieleña de Astronomía. Pero, venga, ¡unas cañas para todos!

Por cierto, que he probado:

  Orden = "-X GET --header 'Accept: application/json' --header 'api_key: eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJjYWxlbmRhcmlvQGFzdHJvZGFpbWllbC5lcyIsImp0aSI6ImFjYjgyZWI1LTViNjgtNDdiZi05MjMzLTUxYjdmYTZjYmYzYSIsImlzcyI6IkFFTUVUIiwiaWF0IjoxNTIwOTY0ODQ1LCJ1c2VySWQiOiJhY2I4MmViNS01YjY4LTQ3YmYtOTIzMy01MWI3ZmE2Y2JmM2EiLCJyb2xlIjoiIn0.yTXK95LZ8Z0jxBx6ddM0lzZUYBBKPtzN56G6ENrPIgA' 'https://opendata.aemet.es/opendata/api/mapasygraficos/analisis' --insecure"
  Debug Orden
  Exec ["curl", Orden] To Salida
  Debug Salida


Y nada de nada. Sigo en la brecha, a ver qué se me ocurre.
 



 
Grandamakulo - Ver perfil del usuarioEnviar mensaje privadoVisitar sitio web del usuario 
Volver arribaPágina inferior
Responder citando   Descargar mensaje  
Mensaje Re: API AEMET 
 
Tomando tu código y cambiando algunas cosas...
descarga la imagen del clima deseada.
 image
Nota: en mi sistema tengo como visor de imagenes xviewer si usas otro cambia el código acorde a tu sistema. También puedes usar Desktop.Open pero como hice un programa de terminal no lo use.

Public Sub Main()
  
  Dim strCommand As String
  Dim strInfo As String
  Dim strLink As String
  Dim stx As New String[]
  Dim int As Integer
  Dim strVal As String
  Dim strTag As String
  Dim stxTag As New String[]
  Dim stxVal As New String[]
  Dim intKey As Integer
  Dim intKeyState As Integer
  Dim intKeyData As Integer
  Dim strDownload As String
  
  strCommand = "curl -X GET --header 'Accept: application/json' --header 'api_key: eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJjYWxlbmRhcmlvQGFzdHJvZGFpbWllbC5lcyIsImp0aSI6ImFjYjgyZWI1LTViNjgtNDdiZi05MjMzLTUxYjdmYTZjYmYzYSIsImlzcyI6IkFFTUVUIiwiaWF0IjoxNTIwOTY0ODQ1LCJ1c2VySWQiOiJhY2I4MmViNS01YjY4LTQ3YmYtOTIzMy01MWI3ZmE2Y2JmM2EiLCJyb2xlIjoiIn0.yTXK95LZ8Z0jxBx6ddM0lzZUYBBKPtzN56G6ENrPIgA' 'https://opendata.aemet.es/opendata/api/mapasygraficos/analisis' --insecure"
  strCommand &= " 2>&1"
  Shell strCommand To strInfo
  strInfo = Replace(strInfo, " : ", "\t")
  strInfo = Replace(strInfo, "\"", "")
  strInfo = Replace(strInfo, "  ", "")
  strInfo = Replace(strInfo, ",", "")
  
  If Exist("/tmp/image.gif") = True Then
    Try Kill "/tmp/image.gif"
  Endif
  
  stx = Split(strInfo, "\n")
  For int = 0 To stx.Max
    If InStr(stx[int], "\t") > 0 Then
      strTag = Split(stx[int], "\t")[0]
      strVal = Split(stx[int], "\t")[1]
      stxTag.Add(strTag)
      stxVal.Add(strVal)
    Endif
  Next
  intKeyState = stxTag.Find("descripcion")
  If intKeyState > -1 Then
    If InStr(stxVal[intKey], "exito") > 0 Then
      intKeyData = stxTag.Find("datos")
      If intKeyData > -1 Then
        strDownload = "wget " & stxVal[intKeyData] & " --output-document=" & "/tmp/image.gif"
        Shell strDownload
        Wait 1
        Shell "xviewer /tmp/image.gif"
      Endif
    Endif
  Endif
  
End
 


Saludos.
 



 
tincho - Ver perfil del usuarioEnviar mensaje privado 
Volver arribaPágina inferior
Responder citando   Descargar mensaje  
Mensaje Re: API AEMET 
 
¡Gracias, Tincho!  
Voy a probarlo y comento.
 



 
Grandamakulo - Ver perfil del usuarioEnviar mensaje privadoVisitar sitio web del usuario 
Volver arribaPágina inferior
Responder citando   Descargar mensaje  
Mensaje Re: API AEMET 
 
Grandamakulo escribió: [Ver mensaje]
¡Gracias, Tincho!  
Voy a probarlo y comento.

Muy bien.
Por cierto se puede consultar la temperatura de un lugar en particular o las lluvias o las estadisticas de heladas etc.??

Saludos.
 



 
tincho - Ver perfil del usuarioEnviar mensaje privado 
Volver arribaPágina inferior
Responder citando   Descargar mensaje  
Mensaje Re: API AEMET 
 
Tincho
Citar:
Por cierto se puede consultar la temperatura de un lugar en particular o las lluvias o las estadisticas de heladas etc.??


Si, mirate esto:
https://opendata.aemet.es/dist/inde...-climatologicos
 




===================
Blog personal
Web: SoloGambas seleccion de articulos dedicados a Gambas
Visita el Curso de Gambas3 ¡¡¡Gratuito!!!
 
jsbsan - Ver perfil del usuarioEnviar mensaje privadoVisitar sitio web del usuario 
Volver arribaPágina inferior
Responder citando   Descargar mensaje  
Mensaje Re: API AEMET 
 
jsbsan escribió: [Ver mensaje]
...Si, mirate esto: https://opendata.aemet.es/dist/inde...-climatologicos

Ok, interesante. le veo muchas aplicaciones a esto.

Saludos.
 



 
tincho - Ver perfil del usuarioEnviar mensaje privado 
Volver arribaPágina inferior
Responder citando   Descargar mensaje  
Mensaje Re: API AEMET 
 
Bueno, aplicando un pequeño añadido al código de Tincho, se puede hacer que la imagen descargada se vea en un formulario.

Lo podeis ver en este enlace:
http://jsbsan.blogspot.com.es/2018/...raer-datos.html
 




===================
Blog personal
Web: SoloGambas seleccion de articulos dedicados a Gambas
Visita el Curso de Gambas3 ¡¡¡Gratuito!!!
 
jsbsan - Ver perfil del usuarioEnviar mensaje privadoVisitar sitio web del usuario 
Volver arribaPágina inferior
Responder citando   Descargar mensaje  
Mensaje Re: API AEMET 
 
jsbsan escribió: [Ver mensaje]
Bueno, aplicando un pequeño añadido al código de Tincho, se puede hacer que la imagen descargada se vea en un formulario.

Muy bueno, así es mas cómodo ver el mapa.
Saludos.
 



 
tincho - Ver perfil del usuarioEnviar mensaje privado 
Volver arribaPágina inferior
Responder citando   Descargar mensaje  
Mensaje Re: API AEMET 
 
Probados ambos códigos, funcionan perfectamente: ¡sois unos hachas!
Muchas gracias a ambos, tincho y jsban, por vuestra ayuda.

Queda aún pendiente, empleando myhttp en lugar de un Exec o un Shell, el formato de las cabeceras en:

myhttp.Get(Cabeceras, "/tmp/Pru.txt")


Pero eso es ya otra historia.
 



 
Grandamakulo - Ver perfil del usuarioEnviar mensaje privadoVisitar sitio web del usuario 
Volver arribaPágina inferior
Mostrar mensajes anteriores:    
 
OcultarTemas parecidos
Tema Autor Foro Respuestas último mensaje
No hay nuevos mensajes Problema Con Datediff SOLUCIONADO desoljor Aplicaciones/Fragmentos de Código 5 Viernes, 18 Abril 2014, 12:24 Ver último mensaje
desoljor
No hay nuevos mensajes Input [SOLUCIONADO] Shell General 1 Miercoles, 16 Julio 2014, 20:23 Ver último mensaje
Shell
No hay nuevos mensajes Caracteres De Url [SOLUCIONADO] shordi General 4 Lunes, 23 May 2016, 22:28 Ver último mensaje
vuott
No hay nuevos mensajes Idioma Del Ide [SOLUCIONADO] ahtonio Instalación 12 Martes, 11 Septiembre 2018, 23:41 Ver último mensaje
tincho
 

Publicar nuevo tema  Responder al tema  Página 2 de 2
Ir a la página Anterior  1, 2

Usuarios navegando en este tema: 0 registrados, 0 ocultos y 1 invitado
Usuarios registrados conectados: Ninguno


 
Lista de permisos
No puede crear mensajes
No puede responder temas
No puede editar sus mensajes
No puede borrar sus mensajes
No puede votar en encuestas
No puede adjuntar archivos
Puede descargar archivos
No puede publicar eventos en el calendario



  

 

cron