Dec-09-2023, 08:47 PM
Hello, this is my first post here. My apologies if this is posted in the wrong place. Are there any .Net programmers here?
I'm trying to convert a python script to VB.net. I have most of it done, but I'm hung up on one part.
This is the line I'm stuck on:
res = ses.get(url, headers=myHeader, timeout=15, verify=False)
This is the header I need to use:
{'User-Agent': 'Mozilla/5.0 (QtEmbedded; U; Linux; C) AppleWebKit/533.3 (KHTML, like Gecko) Mobile Safari/533.3', 'Referer': 'http://myurl.com/c/', 'Accept': 'application/json,application/javascript,text/javascript,text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Encoding': 'gzip, deflate', 'Connection': 'Keep-Alive', 'X-User-Agent': 'Model: ABC123; Link: Ethernet'}
I think I need to use HttpClient in .Net, but I don't know how to add this header. Can I add it as one big string or do I need to break it apart. And how do I handle the timeout & verify parameters? Any help would be much appreciated. Thanks...
I'm trying to convert a python script to VB.net. I have most of it done, but I'm hung up on one part.
This is the line I'm stuck on:
res = ses.get(url, headers=myHeader, timeout=15, verify=False)
This is the header I need to use:
{'User-Agent': 'Mozilla/5.0 (QtEmbedded; U; Linux; C) AppleWebKit/533.3 (KHTML, like Gecko) Mobile Safari/533.3', 'Referer': 'http://myurl.com/c/', 'Accept': 'application/json,application/javascript,text/javascript,text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Accept-Encoding': 'gzip, deflate', 'Connection': 'Keep-Alive', 'X-User-Agent': 'Model: ABC123; Link: Ethernet'}
I think I need to use HttpClient in .Net, but I don't know how to add this header. Can I add it as one big string or do I need to break it apart. And how do I handle the timeout & verify parameters? Any help would be much appreciated. Thanks...