Skip to content
Advertisement

Requests.get failing when using inside function

I am using python requests library to get the data from adzuna api .

if i try

JavaScript

it is fetching me data But if i wrap this inside a fuction

JavaScript

it is giving me following exception

JavaScript

what is the wrong with this function ?

See the Image for more info

Advertisement

Answer

(edited) Since using a single-line query fixed your problem, I’ll recommend that you don’t try to build the query yourself but instead let requests do it for you, like so:

JavaScript

This should be less error-prone and is certainly more convenient.

Advertisement