|
74 | 74 | rate_limit = int(argument.rate_limit) |
75 | 75 | rate_period = int(argument.rate_period) |
76 | 76 |
|
77 | | - fs = firststreet.FirstStreet(api_key, version=argument.version, connection_limit=limit, |
78 | | - rate_limit=rate_limit, rate_period=rate_period, |
| 77 | + formatted_params = {} |
| 78 | + |
| 79 | + if argument.extra_param: |
| 80 | + for element in argument.extra_param.split(";"): |
| 81 | + key, value = element.split(":") |
| 82 | + formatted_params[key] = ast.literal_eval(value) |
| 83 | + |
| 84 | + fs = firststreet.FirstStreet(api_key, |
| 85 | + version=argument.version, |
| 86 | + connection_limit=limit, |
| 87 | + rate_limit=rate_limit, |
| 88 | + rate_period=rate_period, |
79 | 89 | log=bool(strtobool(argument.log))) |
80 | 90 |
|
81 | 91 | if argument.product == 'adaptation.get_detail': |
82 | 92 | fs.adaptation.get_detail(search_items, |
83 | 93 | csv=True, |
84 | 94 | output_dir=argument.output_dir, |
85 | | - extra_param=argument.extra_param) |
| 95 | + extra_param=formatted_params) |
86 | 96 |
|
87 | 97 | elif argument.product == 'adaptation.get_summary': |
88 | 98 | fs.adaptation.get_summary(search_items, |
89 | 99 | argument.location_type, |
90 | 100 | csv=True, |
91 | 101 | output_dir=argument.output_dir, |
92 | | - extra_param=argument.extra_param) |
| 102 | + extra_param=formatted_params) |
93 | 103 |
|
94 | 104 | elif argument.product == 'adaptation.get_detail_by_location': |
95 | 105 | fs.adaptation.get_detail_by_location(search_items, |
96 | 106 | argument.location_type, |
97 | 107 | csv=True, |
98 | 108 | output_dir=argument.output_dir, |
99 | | - extra_param=argument.extra_param) |
| 109 | + extra_param=formatted_params) |
100 | 110 |
|
101 | 111 | elif argument.product == 'probability.get_depth': |
102 | 112 | fs.probability.get_depth(search_items, |
103 | 113 | csv=True, |
104 | 114 | output_dir=argument.output_dir, |
105 | | - extra_param=argument.extra_param) |
| 115 | + extra_param=formatted_params) |
106 | 116 |
|
107 | 117 | elif argument.product == 'probability.get_chance': |
108 | 118 | fs.probability.get_chance(search_items, |
109 | 119 | csv=True, |
110 | 120 | output_dir=argument.output_dir, |
111 | | - extra_param=argument.extra_param) |
| 121 | + extra_param=formatted_params) |
112 | 122 |
|
113 | 123 | elif argument.product == 'probability.get_count_summary': |
114 | 124 | fs.probability.get_count_summary(search_items, |
115 | 125 | csv=True, |
116 | 126 | output_dir=argument.output_dir, |
117 | | - extra_param=argument.extra_param) |
| 127 | + extra_param=formatted_params) |
118 | 128 |
|
119 | 129 | elif argument.product == 'probability.get_cumulative': |
120 | 130 | fs.probability.get_cumulative(search_items, |
121 | 131 | csv=True, |
122 | 132 | output_dir=argument.output_dir, |
123 | | - extra_param=argument.extra_param) |
| 133 | + extra_param=formatted_params) |
124 | 134 |
|
125 | 135 | elif argument.product == 'probability.get_count': |
126 | 136 | fs.probability.get_count(search_items, |
127 | 137 | argument.location_type, |
128 | 138 | csv=True, |
129 | 139 | output_dir=argument.output_dir, |
130 | | - extra_param=argument.extra_param) |
| 140 | + extra_param=formatted_params) |
131 | 141 |
|
132 | 142 | elif argument.product == 'historic.get_event': |
133 | 143 | fs.historic.get_event(search_items, |
134 | 144 | csv=True, |
135 | 145 | output_dir=argument.output_dir, |
136 | | - extra_param=argument.extra_param) |
| 146 | + extra_param=formatted_params) |
137 | 147 |
|
138 | 148 | elif argument.product == 'historic.get_summary': |
139 | 149 | fs.historic.get_summary(search_items, |
140 | 150 | argument.location_type, |
141 | 151 | csv=True, |
142 | 152 | output_dir=argument.output_dir, |
143 | | - extra_param=argument.extra_param) |
| 153 | + extra_param=formatted_params) |
144 | 154 |
|
145 | 155 | elif argument.product == 'historic.get_events_by_location': |
146 | 156 | fs.historic.get_events_by_location(search_items, |
147 | 157 | argument.location_type, |
148 | 158 | csv=True, |
149 | 159 | output_dir=argument.output_dir, |
150 | | - extra_param=argument.extra_param) |
| 160 | + extra_param=formatted_params) |
151 | 161 |
|
152 | 162 | elif argument.product == 'location.get_detail': |
153 | 163 | fs.location.get_detail(search_items, |
154 | 164 | argument.location_type, |
155 | 165 | csv=True, |
156 | 166 | output_dir=argument.output_dir, |
157 | | - extra_param=argument.extra_param) |
| 167 | + extra_param=formatted_params) |
158 | 168 |
|
159 | 169 | elif argument.product == 'location.get_summary': |
160 | 170 | fs.location.get_summary(search_items, |
161 | 171 | argument.location_type, |
162 | 172 | csv=True, |
163 | 173 | output_dir=argument.output_dir, |
164 | | - extra_param=argument.extra_param) |
| 174 | + extra_param=formatted_params) |
165 | 175 |
|
166 | 176 | elif argument.product == 'fema.get_nfip': |
167 | 177 | fs.fema.get_nfip(search_items, |
168 | 178 | argument.location_type, |
169 | 179 | csv=True, |
170 | 180 | output_dir=argument.output_dir, |
171 | | - extra_param=argument.extra_param) |
| 181 | + extra_param=formatted_params) |
172 | 182 |
|
173 | 183 | elif argument.product == 'environmental.get_precipitation': |
174 | 184 | fs.environmental.get_precipitation(search_items, |
175 | 185 | csv=True, |
176 | 186 | output_dir=argument.output_dir, |
177 | | - extra_param=argument.extra_param) |
| 187 | + extra_param=formatted_params) |
178 | 188 |
|
179 | 189 | elif argument.product == 'tile.get_probability_depth': |
180 | 190 | if not argument.year: |
|
223 | 233 | output_dir=argument.output_dir, |
224 | 234 | image=True) |
225 | 235 |
|
| 236 | + elif argument.product == 'aal.get_summary': |
| 237 | + fs.aal.get_summary(search_items, |
| 238 | + argument.location_type, |
| 239 | + csv=True, |
| 240 | + output_dir=argument.output_dir, |
| 241 | + extra_param=formatted_params) |
| 242 | + |
| 243 | + elif argument.product == 'avm.get_avm': |
| 244 | + fs.avm.get_avm(search_items, |
| 245 | + csv=True, |
| 246 | + output_dir=argument.output_dir, |
| 247 | + extra_param=formatted_params) |
| 248 | + |
| 249 | + elif argument.product == 'avm.get_provider': |
| 250 | + fs.avm.get_provider(search_items, |
| 251 | + csv=True, |
| 252 | + output_dir=argument.output_dir, |
| 253 | + extra_param=formatted_params) |
| 254 | + |
226 | 255 | else: |
227 | 256 | logging.error("Product not found. Please check that the argument" |
228 | 257 | " provided is correct: {}".format(argument.product)) |
|
0 commit comments