I have this python code here:
def location(location_id, max_id=None):
        # Send http request to 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 is 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 I run the program, it raises the following error:
SyntaxError: invalid syntax
The error seems to show up at line 447 which is the following:
if max_id is not None: payload['max_id'] = max_id
The weird thing is that the code was working before and I added some code before this line so I think the error comes from a previous line.
Unfortunately, I can't see it.
Thanks!
 
     
    