Python invalid syntax on conditional -
i have python code here:
def location(location_id, max_id=none): # send http request find location if (self.login_status): get_location = {'location_id': location_id} url_location_detail = self.url_location_detail % (location_id) try: get_location_id = self.i.get(url_location_detail, data=body) if location.status_code == 200: log_string = "get location id: %d" % (location_id) self.write_log(log_string) if max_id not none: payload['max_id'] = max_id try: res = requests.get(url, params=payload).json() body = res['location'] cursor = res['location']['media']['page_info']['end_cursor'] except: raise return instagramexploreresponse(data=body, cursor=cursor) when run program, raises following error:
syntaxerror: invalid syntax the error seems show @ line 447 following:
if max_id not none: payload['max_id'] = max_id the weird thing code working before , added code before line think error comes previous line.
unfortunately, can't see it.
thanks!
you can find need here: putting simple if-then statement on 1 line
they explain why error showing , ways solve it
being more clear here, can't put inside if in front of if in python. this:
if max_id not none: payload['max_id'] = max_id become this:
if max_id not none: payload['max_id'] = max_id
Comments
Post a Comment