Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. from schematics import Model
  2. from schematics.types import (
  3. DateTimeType,
  4. FloatType,
  5. IntType,
  6. ListType,
  7. ModelType,
  8. StringType,
  9. BooleanType
  10. )
  11.  
  12.  
  13. class Wind(Model):
  14. direction = StringType()
  15. direction_degrees = FloatType()
  16. direction_to = StringType()
  17. direction_to_degrees = FloatType()
  18. direction_from = StringType()
  19. direction_from_degrees = FloatType()
  20. gust = FloatType()
  21. unit = StringType()
  22. value = FloatType()
  23.  
  24.  
  25. class Visibility(Model):
  26. unit = StringType()
  27. value = FloatType()
  28. direction = StringType()
  29. direction_degrees = FloatType()
  30.  
  31.  
  32. class RunwayVisibility(Model):
  33. high = FloatType()
  34. low = FloatType()
  35. name = StringType()
  36. unit = StringType()
  37.  
  38.  
  39. class Temperature(Model):
  40. dew_point = FloatType()
  41. temperature = FloatType()
  42. unit = StringType()
  43.  
  44.  
  45. class Pressure(Model):
  46. unit = StringType()
  47. value = FloatType()
  48.  
  49.  
  50. class Report(Model):
  51. cycle = IntType()
  52. modifier = StringType()
  53. type = StringType()
  54.  
  55.  
  56. class Altitude(Model):
  57. unit = StringType()
  58. value = FloatType()
  59.  
  60.  
  61. class Sky(Model):
  62. altitude = ModelType(Altitude)
  63. cloud_coverage = StringType()
  64.  
  65.  
  66. class WeatherObservation(Model):
  67. metar = StringType()
  68. station_id_icao = StringType()
  69. station_id = StringType()
  70. version = IntType()
  71. datetime = DateTimeType()
  72. timestamp = IntType()
  73. report = ModelType(Report)
  74. wind = ModelType(Wind)
  75. visibility = ModelType(Visibility)
  76. weather = ListType(StringType, default=[])
  77. sky = ListType(ModelType(Sky))
  78. temperature = ModelType(Temperature)
  79. pressure = ModelType(Pressure)
  80. runway_visibility = ListType(ModelType(RunwayVisibility))
  81. remarks = ListType(StringType)
  82. unsafe_to_operate = BooleanType()
  83.  
  84.  
  85. class AirportWeatherResponse(Model):
  86. observations = ListType(ModelType(WeatherObservation))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement