-
Notifications
You must be signed in to change notification settings - Fork 4
/
get_endpoints.cs
32 lines (28 loc) · 1.01 KB
/
get_endpoints.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System;
using System.IO;
using System.Net;
namespace Smartproxy_API
{
class get_endpoints
{
static void Main(string[] args)
{
// Details from authentication
string token = "";
string uri = "https://api.smartproxy.com/v1/endpoints";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
request.AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
request.PreAuthenticate = true;
request.Headers.Add("Authorization", "Token " + token);
request.ContentType = "application/json";
request.Method = "GET";
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
using (Stream stream = response.GetResponseStream())
using (StreamReader reader = new StreamReader(stream))
{
Console.WriteLine(reader.ReadToEnd());
Console.ReadKey();
}
}
}
}