bigracefan18 / sharepoint-twitter

Automatically exported from code.google.com/p/sharepoint-twitter
0 stars 0 forks source link

Proxy settings #28

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
This is more of a feature request instead of an issue.

Could you please add options to the web-parts to configure a HTTP proxy that it 
will connect through to get to twitter. I'm sure this could fix some of the 
"Value cannot be null. Parameter name: value" errors that people have reported.

Twitterizer has the option to do this by adding a System.Net.WebProxy to the 
options like this (in ShowTweets.FetchTweets()):

  //set the tokens here
  OAuthTokens tokens = new OAuthTokens();
  tokens.ConsumerKey = this.ConsumerKey;
  tokens.ConsumerSecret = this.ConsumerSecret;
  tokens.AccessToken = this.AccessToken;
  tokens.AccessTokenSecret = this.AccessTokenSecret;

  UserTimelineOptions options = new UserTimelineOptions();
  options.Count = this.TweetCount * PageNumber;
  options.Page = 1;
  options.ScreenName = this.ScreenName;

  if(proxyRequired) {
    var proxy = new System.Net.WebProxy(this.proxyUri, Convert.ToInt32(this.proxyPort));
    proxy.Credentials = new NetworkCredential(this.proxyUser, this.proxyPassword);
    options.Proxy = proxy;

    if(sslRequired) {
      options.UseSSL = true;
    }
  }

  //now hit the twitter and get the response
  tweets = TwitterTimeline.UserTimeline(tokens, options).ResponseObject;

Thanks

Original issue reported on code.google.com by vchegwid...@gmail.com on 11 Sep 2013 at 9:57