brainsqueeze commited on
Commit
16ab811
·
verified ·
1 Parent(s): d88215e

Change GET to POST requests to avoid URL character limits

Browse files
Files changed (1) hide show
  1. services.py +51 -39
services.py CHANGED
@@ -91,7 +91,7 @@ def cost_estimator(
91
  program_desc: Optional[str] = None
92
  ) -> str:
93
  estimate: str = _post_json(
94
- "/budget",
95
  payload={
96
  "recipient_candid_entity_id": recipient_candid_entity_id,
97
  "program_description": program_desc,
@@ -130,59 +130,71 @@ def draft_letter(
130
  contact_information: str = ""
131
  ):
132
  gr.Info("Writing the letter, please scroll to the top of the page.")
133
- opening: str = _get_json(
134
  "/writer/opening",
135
- funder_name=funder_name,
136
- recipient_name=recipient_name,
137
- project_name=project_name,
138
- project_purpose=project_purpose,
139
- amount=amount,
140
- prior_contact=prior_contact,
141
- connection=connection
 
 
142
  )
143
 
144
- recipient_description: str = _get_json(
145
  "/writer/org",
146
- opening=opening,
147
- recipient_mission_statement=recipient_mission_statement,
148
- capacity=capacity,
149
- history=recipient_history,
150
- path=path_to_solution,
151
- accomplishment=recent_accomplishments
 
 
152
  )
153
 
154
- need_statement: str = _get_json(
155
  "/writer/need",
156
- recipient_desc=recipient_description,
157
- target=geo_pop_targets,
158
- data=project_data_stats,
159
- funder_mission_statement=funder_mission_statement
 
 
160
  )
161
 
162
- project_description: str = _get_json(
163
  "/writer/project",
164
- need=need_statement,
165
- projects=projects,
166
- desired_objectives=desired_objectives,
167
- major_activities=major_activities,
168
- key_staff=key_staff,
169
- stand_out=standout_features,
170
- success=success_metric
 
 
171
  )
172
 
173
- funding_request: str = _get_json(
174
  "/writer/fund",
175
- project_desc=project_description,
176
- amount=amount,
177
- funding_history=mutual_history,
178
- other_funding=other_funding_sources
 
 
179
  )
180
 
181
- conclusion: str = _get_json(
182
  "/writer/conclusion",
183
- funding_request=funding_request,
184
- project_desc=project_description,
185
- follow_up=contact_information
 
 
186
  )
187
 
188
  return (
@@ -206,7 +218,7 @@ def send_feedback(
206
  email: Optional[str] = None
207
  ) -> int:
208
  count = _post_json(
209
- "/feedback",
210
  payload={
211
  "context": context,
212
  "letter": letter,
 
91
  program_desc: Optional[str] = None
92
  ) -> str:
93
  estimate: str = _post_json(
94
+ "budget",
95
  payload={
96
  "recipient_candid_entity_id": recipient_candid_entity_id,
97
  "program_description": program_desc,
 
130
  contact_information: str = ""
131
  ):
132
  gr.Info("Writing the letter, please scroll to the top of the page.")
133
+ opening: str = _post_json(
134
  "/writer/opening",
135
+ payload=dict(
136
+ funder_name=funder_name,
137
+ recipient_name=recipient_name,
138
+ project_name=project_name,
139
+ project_purpose=project_purpose,
140
+ amount=amount,
141
+ prior_contact=prior_contact,
142
+ connection=connection
143
+ )
144
  )
145
 
146
+ recipient_description: str = _post_json(
147
  "/writer/org",
148
+ payload=dict(
149
+ opening=opening,
150
+ recipient_mission_statement=recipient_mission_statement,
151
+ capacity=capacity,
152
+ history=recipient_history,
153
+ path=path_to_solution,
154
+ accomplishment=recent_accomplishments
155
+ )
156
  )
157
 
158
+ need_statement: str = _post_json(
159
  "/writer/need",
160
+ payload=dict(
161
+ recipient_desc=recipient_description,
162
+ target=geo_pop_targets,
163
+ data=project_data_stats,
164
+ funder_mission_statement=funder_mission_statement
165
+ )
166
  )
167
 
168
+ project_description: str = _post_json(
169
  "/writer/project",
170
+ payload=dict(
171
+ need=need_statement,
172
+ projects=projects,
173
+ desired_objectives=desired_objectives,
174
+ major_activities=major_activities,
175
+ key_staff=key_staff,
176
+ stand_out=standout_features,
177
+ success=success_metric
178
+ )
179
  )
180
 
181
+ funding_request: str = _post_json(
182
  "/writer/fund",
183
+ payload=dict(
184
+ project_desc=project_description,
185
+ amount=amount,
186
+ funding_history=mutual_history,
187
+ other_funding=other_funding_sources
188
+ )
189
  )
190
 
191
+ conclusion: str = _post_json(
192
  "/writer/conclusion",
193
+ payload=dict(
194
+ funding_request=funding_request,
195
+ project_desc=project_description,
196
+ follow_up=contact_information
197
+ )
198
  )
199
 
200
  return (
 
218
  email: Optional[str] = None
219
  ) -> int:
220
  count = _post_json(
221
+ "feedback",
222
  payload={
223
  "context": context,
224
  "letter": letter,