This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace ConsoleApplication | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var task = RunProgram(); | |
task.Wait(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private async void MainPage_Loaded(object sender, RoutedEventArgs e) | |
{ | |
await GetAccessToken(); | |
// navigate to AccountsPage.xaml | |
this.Frame.Navigate(typeof (AccountsPage)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import xml.etree.ElementTree as ET | |
def login(userName, password): | |
request = u"""<?xml version="1.0" encoding="utf-8" ?> | |
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"> | |
<env:Body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def addBatch(instance, sessionId, jobId, objects): | |
request = u"""<?xml version="1.0" encoding="UTF-8"?> | |
<sObjects xmlns="http://www.force.com/2009/06/asyncapi/dataload"> | |
""" + objects + """ | |
</sObjects>""" | |
encoded_request = request.encode('utf-8') | |
url = "https://" + instance + ".salesforce.com/services/async/30.0/job/" + jobId + "/batch" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import base64 | |
import json | |
from simple_salesforce import Salesforce | |
userName = '' | |
password = '' | |
securityToken = '' | |
instance = '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import psycopg2 | |
import urlparse | |
urlparse.uses_netloc.append("postgres") | |
url = urlparse.urlparse(os.environ["DATABASE_URL"]) | |
conn = psycopg2.connect( | |
database=url.path[1:], | |
user=url.username, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import psycopg2 | |
import urlparse | |
import pika, logging | |
urlparse.uses_netloc.append("postgres") | |
url = urlparse.urlparse(os.environ["DATABASE_URL"]) | |
logging.basicConfig() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TokenValidationHandler : DelegatingHandler | |
{ | |
private readonly string _storageConnectionString = CloudConfigurationManager.GetSetting("StorageConnectionString"); | |
protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) | |
{ | |
const string errorMessage = "Unauthorized access; {0}"; | |
const HttpStatusCode code = HttpStatusCode.Unauthorized; | |
var authValue = request.Headers.Authorization; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-16"?> | |
<application xmlns="http://wadl.dev.java.net/2009/02" xmlns:siena="http://schemas.microsoft.com/MicrosoftProjectSiena/WADL/2014/11" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:sienatool="http://www.todo.com" | |
siena:serviceId="WadeAPIServiceWadl"> | |
<grammars> | |
<jsonTypes targetNamespace="http://www.todo.com" xmlns="http://schemas.microsoft.com/MicrosoftProjectSiena/WADL/2014/11"> | |
<object name="GetAccounts_Root"> | |
<property name="totalSize" type="number" /> | |
<property name="done" type="boolean" /> | |
<property name="records" typeRef="GetAccounts_records_Array" /> | |
</object> |