Skip to content

Consider allowing Porter API parameters to be passed via URL query strings #2735

@derekpierre

Description

@derekpierre

Related to derekpierre#5.

Prior discussion on Discord with @vepkenez.


damonC — Yesterday at 9:40 PM
@derek made a https://github.com/derekpierre/nucypher/pull/5  all this stuff is standard and web developers deal with long URLs all the time

---

derek — Today at 1:01 PM
Thanks for the PR :thumbsup: !

Question: how do I correctly provide a list as a parameter? i.e. for include/exclude ursulas parameters. Perhaps I am providing it incorrectly...?

Trying the URL parameter approach with the fix, I get a 400, and a message that include_ursulas parameter is not a valid list
>  r = requests.get('http://127.0.0.1:9155/get_ursulas?quantity=2&duration_periods=4&include_ursulas=["0xC23F4F463c779Dd27c08939dC495b8b35C952c89"]')
>  r.text
Out[211]: "{'include_ursulas': ['Not a valid list.']}"


and the request body has include_ursulas as a string
>>>>> request body: {'quantity': '2', 'duration_periods': '4', 'include_ursulas': '["0xC23F4F463c779Dd27c08939dC495b8b35C952c89"]'}


Providing multiple values yields a 400 as well:
>  r = requests.get('http://127.0.0.1:9155/get_ursulas?quantity=2&duration_periods=4&include_ursulas=0xC23F4F463c779Dd27c08939dC495b8b35C952c89&include_ursulas=0xbdA6Ba3Ad624582495C55451A')

and yields the following request body with a single string entry value for include_ursulas
>>>>> request body: {'quantity': '2', 'duration_periods': '4', 'include_ursulas': '0xC23F4F463c779Dd27c08939dC495b8b35C952c89'}

---

damonC — Today at 1:04 PM
Hmm it may be slightly complex… https://stackoverflow.com/questions/57914396/list-of-query-params-with-flask-request-args
I didn’t try include_ursulas[]=…
That is a common way to do it… but might need that getlist stuff… which is no fun

Metadata

Metadata

Labels

ProtocolProtocol designWebWebpages

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions