mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 02:26:55 -07:00
Added code to request the api key for CouchPotato
This commit is contained in:
parent
f9af1dc12b
commit
ae64c11485
10 changed files with 670 additions and 484 deletions
|
@ -31,6 +31,7 @@ using Newtonsoft.Json.Linq;
|
|||
using NLog;
|
||||
using PlexRequests.Api.Interfaces;
|
||||
using PlexRequests.Api.Models.Movie;
|
||||
using PlexRequests.Helpers;
|
||||
using PlexRequests.Helpers.Exceptions;
|
||||
|
||||
using RestSharp;
|
||||
|
@ -159,5 +160,22 @@ namespace PlexRequests.Api
|
|||
return new CouchPotatoMovies();
|
||||
}
|
||||
}
|
||||
|
||||
public CoucPotatoApiKey GetApiKey(Uri baseUrl, string username, string password)
|
||||
{
|
||||
var request = new RestRequest
|
||||
{
|
||||
Resource = "getkey/?p={username}&u={password}",
|
||||
Method = Method.GET
|
||||
};
|
||||
|
||||
request.AddUrlSegment("username", StringHasher.CalcuateMD5Hash(username));
|
||||
request.AddUrlSegment("password", StringHasher.CalcuateMD5Hash(password));
|
||||
|
||||
var obj = RetryHandler.Execute(() => Api.Execute<CoucPotatoApiKey>(request, baseUrl), null,
|
||||
(exception, timespan) => Log.Error(exception, "Exception when calling GetApiKey for CP, Retrying {0}", timespan));
|
||||
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue