Exemplo n.º 1
0
        private static string GetIssues(RestResponseCookie cookie, RestClient client)
        {
            var request = new RestRequest("rest/issue/byproject/TP?max=1000", Method.GET);
            request.AddCookie(cookie.Name, cookie.Value);
            var response = client.Execute(request);

            ThrowIfNotOk(response, "could not get issues");

            return response.Content;
        }
Exemplo n.º 2
0
 public bool Login(ref char[] rollno, ref char[] password)
 {
     RestClient client = new RestClient (@"http://internship.iitm.ac.in/students/login.php") {
         FollowRedirects = false
     };
     RestRequest request = new RestRequest (Method.POST);
     request.AddParameter ("rollno", new string (rollno), ParameterType.GetOrPost);
     request.AddParameter ("pass", new string (password), ParameterType.GetOrPost);
     request.AddParameter ("submit", "Login", ParameterType.GetOrPost);
     IRestResponse response = client.Execute (request);
     if (response.StatusCode != HttpStatusCode.Found)
         return false;
     cookie = response.Cookies.First ();
     WipeChar (ref rollno);
     WipeChar (ref password);
     return true;
 }
Exemplo n.º 3
0
 static IRestResponse LoginToMoodle(string userName, string password)
 {
     RestClient client = new RestClient("https://courses.iitm.ac.in/login/index.php")
     {
         CookieContainer = new CookieContainer()
     };
     RestRequest request = new RestRequest(Method.POST);
     request.AddParameter("username", userName, ParameterType.GetOrPost);
     request.AddParameter("password", password, ParameterType.GetOrPost);
     request.AddHeader("HTTPonly", "true");
     IRestResponse response = client.Execute(request);
     string xCookie = client.CookieContainer.GetCookieHeader(new Uri("http://courses.iitm.ac.in"));
     string[] parsedStrings = xCookie.Split(new char[] { '=' });
     IList<RestResponseCookie> cookies = response.Cookies;
     RestResponseCookie restResponseCookie = new RestResponseCookie()
     {
         Name = parsedStrings[0],
         Value = parsedStrings[1]
     };
     cookies.Add(restResponseCookie);
     return response;
 }