Not sending request after several sending

Issue

This Content is from Stack Overflow. Question asked by Advaita

When I execute the following code, the requests are sent and the result is received, but after sending several requests, no more requests are sent, as if the program stops.
I am not getting any error

I don’t know where the problem is

I would be grateful if someone could help me

async def get_data():
    global data_list,temp
    global counter

    
    counter=1
    while True:
        user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36'
        headers = {'Connection': 'close','User-Agent':user_agent }

        r = requests.get(url,headers=headers)

        else:
            counter += 1
            print("Number Of Requests : ",counter)
            main_txt = r.text
            csvs = main_txt.split('@')
            main_csv = csvs[2]
            csv = main_csv.split(';')
            rows = [row.split(',') for row in csv]
            prise_lahze_list.clear()
            for i in range(len(rows)):
                if rows[i][22] in stock_keys:
                    prise_lahze_list += [
                        rows[i][1:2] + list(map(float, rows[i][7:8]))
                        ]
            signal(data)
            r.close()
        await asyncio.sleep(1)



Solution

This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?