Home > OS >  Pass Multiple Strings in Python API Call
Pass Multiple Strings in Python API Call

Time:11-06

I am currently new in Python and working on processing some API calls. I have a set of distinct arrays that I need to pass in a parameter.

Currently, I have this:

requests.get('https://randomuser.me/api/?seed={7D3375FE},{A87F7113}')

However, this only returns the result set for the first parameter (7D3375FE). I am looking for both results to show up.

I have 11 distinct profiles I need to parse, so any help on how I can pass multiple arguments would be helpful.

Thanks.

CodePudding user response:

Unfortunately, this does not work because that API is not built to handle that type of request. When you set seed={7D3375FE},{A87F7113}, it actually seems to use the string {7D3375FE},{A87F7113} as your seed.

If you need to run this on a number of inputs, you probably need to make multiple requests. However, if you do not care about passing in multiple seeds and simply want 11 users, you can make requests to https://randomuser.me/api/?results=11.

  • Related