Is it possible to configure HttpClient in C# to consistently retrieve website meta data without being blocked?

I’ve set up an HttpClient to retrieve meta data from websites to build a preview when a url is posted in a user message to my website. This works with links to most sites but a significant number do not return the data expected. For example https://www.opendemocracy.net/en/uk/ – both Facebook and Twitter retrieve the meta … Read more

Why I am getting HTTP 404 Not Found for getting access token using Mircrosft Graph API

I am trying to get access token using microsoft graph api via postman. I have provided client id and client secret (please refer to the attached screenshot). I am getting http 404 not found error. I am using following endpoint for fetching access token. https://login.microsoftonline.com/{{TenantID}}/oauth2/v2.0/token I trying write a function that will fetch the access … Read more

Merge dataframes by the nearest lower or equal date

I have two data frames: df1 = pd.DataFrame({‘ID’:[‘A’, ‘A’, ‘B’, ‘B’], ‘Date’:[‘31.08.2023’, ‘12.09.2023’, ‘13.09.2023’, ‘20.08.2023’]}) df2 = pd.DataFrame({‘ID’:[‘A’, ‘A’, ‘A’, ‘B’, ‘B’], ‘Date’:[‘30.08.2023’, ‘14.09.2023’, ‘10.09.2023’, ‘28.09.2023’, ‘19.08.2023’]}) I want to add two new columns to df1 with the nearest higher and lower date in every ID, so the desire output in this example will look … Read more

python-dbus service process id

using dbus-python on Linux: I can find out if there is a service provider: SERVICE = ‘com.example.service’ bus = dbus.SystemBus() print(bus.name_has_owner(SERVICE) is there a way to get the process id of the provider of the server?

Nsubstitute How to mock private method called by method being tested

I want to create a unit test far a method that looks like this public async Task<Country> Get(string slug) { var entityId = GetCountryEntityId(string slug); … Do stuff } Which calls this private method private string GetCountryEntityId(string slug) { var properties = new EntityProperties(slug, CacheHandlerKeys.Countries, “allCountries”); var entityId = _entityIdService.GetEntityId(properties); if (string.IsNullOrEmpty(entityId)) { var e … Read more

Unable to convert PDF file to uint8Array

I am unable to convert a PDF file to uint8, which I get as a response to an API request. When printing out the response in the console, it has this form: %PDF-1.4 %���� 1 0 obj <</CreationDate(D:20231025135518+02’00’)/Creator( … >> endobj 2 0 obj … I am trying to display the PDF I get as … Read more