3
$\begingroup$

I'm trying to connect to the twitter API with the command:

ServiceConnect["Twitter"]

That's no problem if I do this at home behind my router. But when I do that at my company, it does not work and I get a URL:Fetch error.

So my question is: Do I need administrator rights because I (in this case the ServiceConnect object) need to call the browser from Mathematica?

Or is that a problem during to the firewall? I do not think it's a firewall problem because I think the call is just an HTTP or HTTPS request. The Twitter page is not blocked when I call it from the browser.

Thanks for any help.

$\endgroup$
  • $\begingroup$ As a check: can you use Alpha from within Mathematica when you're using your company connection? $\endgroup$ – J. M. is away Mar 26 '18 at 19:09
  • $\begingroup$ What's the specific error you get? You might not be able to connect to Wolfram's paclet server from which ServiceConnect attempts to update. If that's the case use Block[{$AllowInternet = False}, twitter = ServiceConnect["Twitter"]]. $\endgroup$ – b3m2a1 Mar 26 '18 at 19:27
  • $\begingroup$ The error is: ""URLFetch::invhttp: Couldn't connect to Server". I tried Block[{$AllowInternet = False}, twitter = ServiceConnect["Twitter"]] but than I can´t use any twitter command since it Needs Internet. $\endgroup$ – Dan Mar 27 '18 at 7:08
  • $\begingroup$ ServiceConnect underneaths make call to URLFetch, Can you check what does URLFetch["https://api.twitter.com/oauth/request_token"] returns for you(Its ok if you get error code related to bad authentication data)? Also are you seeing this with Twitter service only? Are you able to connect to say other light weight services that don't use OAuth like ServiceConnect["OpenLibrary"]? $\endgroup$ – dsingh Mar 28 '18 at 19:18
  • $\begingroup$ I tried it and for URLFetch["api.twitter.com/oauth/request_token"] I get the same error URLFetch::invhttp: Couldn't connect to server. If I try ServiceConnect["OpenLibrary"] Mathematica whants me to connect to the cloud (I dont have an ID right now) but it also gives back a connected ServiceObject to OpenLibrary. So OpenLibrary seems to work. I´m using Mathematica version11.0.1.0. $\endgroup$ – Dan Apr 3 '18 at 9:43
4
$\begingroup$

Finally I figured it out together with the Mathematica support. If you what to connect to the internet and have a proxy that has its definition file not local but from a server within the network, you need to put in the proxy-data to Mathemtica.

Normally Mathematica gets the proxy-data directly from the local webbrowser. But if the definition is not localy stored this is not possible.

Somone can set a proxy in Mathematica with: Edit ->Preferences -> Internet & Mail -> Proxy Settings.

Hope this helps someone in the future :).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.