How to iterate dict in string.format

I read a lot of tutorials, but can not find how to iterate dict in string.format like this: dict = {‘this’:’I’,’is’:’am’,’title’:’done’} print(f’the key is {k for k,v in dict}’) print(f’the val is {v for k,v in dict}’) which I want a result like this: the key is this is title the val is I am… Read More How to iterate dict in string.format

ArguementType: 'Big Decimal' does not match the type of the format specified '%d'

String stockStr = " "; for (StockRecordDTO stockNumber : stockID){ stockStr+= String.format("the stock %s for Date %s with Quantity %d ", stockNumber.getStock(), stockNumber.getBusinessDate(), stockNumber.getQuantity() ); } I am trying to print out an ArrayList of values by extracting it to a string and then printing it this way. I am getting the Values from a… Read More ArguementType: 'Big Decimal' does not match the type of the format specified '%d'

How to handle "The given header was not found" when paging records in c# API GET request?

I’m requesting data from an API that requires paging records based on a custom header called "cursor". Only 100 records may be retrieved per call and as such I’ve created a while loop to execute. The loop functions… until it doesn’t. Once all records are paged, the headers get dropped and my program errors out… Read More How to handle "The given header was not found" when paging records in c# API GET request?

Task restart immediately after completion while parallel processing

I have to restart all task immediately after completion of the same. Please have a look into my program below; class Program { static async Task Main(string[] args) { int _count = 1; while (true) { await ProcessTasksAsync(); Console.Write("—-Restart Tasks—-" + (_count++).ToString() + Environment.NewLine); await Task.Delay(2000); } } static async Task ProcessTasksAsync() { Task<int> taskA… Read More Task restart immediately after completion while parallel processing

Using .format() in a dictionary with an API call

I am making an api call and in doing so I have to manually change the endDate in the payload every day. I can not use .format() inside a dictionary. Can anyone help out? Current payload: where I am changing the endDate manually payload = "{\"dimensions\":[\"AdsetId\",\"Adset\",\"CampaignId\",\"Campaign\",\"Device\",\"Day\",\"Month\",\"Year\",\"Week\",\"Os\"],\"metrics\":[\"AdvertiserCost\",\"Displays\",\"ClickThroughRate\",\"Cpc\",\"AppInstalls\",\"Clicks\"],\"timezone\":\"UTC\",\"advertiserIds\":\"69957\",\"currency\":\"USD\",\"startDate\":\"2022-01-01T00:00:00.0000000+00:00\",\"***endDate\":\"2022-01-13***T00:00:00.0000000+00:00\",\"format\":\"csv\"}" Expected payload: payload = "{\"dimensions\":[\"AdsetId\",\"Adset\",\"CampaignId\",\"Campaign\",\"Device\",\"Day\",\"Month\",\"Year\",\"Week\",\"Os\"],\"metrics\":[\"AdvertiserCost\",\"Displays\",\"ClickThroughRate\",\"Cpc\",\"AppInstalls\",\"Clicks\"],\"timezone\":\"UTC\",\"advertiserIds\":\"69957\",\"currency\":\"USD\",\"startDate\":\"2022-01-01T00:00:00.0000000+00:00\",\endDate\":\"{}T00:00:00.0000000+00:00\",\"format\":\"csv\"}".format(today) Here today will be… Read More Using .format() in a dictionary with an API call