How to set keys & access tokens for Twitter Spark streaming?

0 votes

I am executing a Spark Streaming example where I am fetching data from Twitter based on the specified tags. When I am running TwitterPopularTags.scala, I am getting authentication failure issue.

Later I figured out I am haven’t set the twitter login keys, which need to be provided.

System.setProperty("twitter4j.oauth.consumerKey", "****");
System.setProperty("twitter4j.oauth.consumerSecret", "****");
System.setProperty("twitter4j.oauth.accessToken", "****");
System.setProperty("twitter4j.oauth.accessTokenSecret", "****");
 

Can anyone explain me this how to do this?

May 24, 2018 in Apache Spark by coder_jazz
122 views

1 answer to this question.

0 votes

Either you have to create a Twitter4j.properties file where you need to specify the four keys or you can go ahead and specify the keys in you program as well. But you need to use twitter4j jar for that.

oauth.consumerKey=****
oauth.consumerSecret=****
oauth.accessToken=****
oauth.accessTokenSecret=****

Go to  https://apps.twitter.com/ link. There you need to create a Twitter application and you’ll get the keys in Keys & Access Tokens tab.

answered May 24, 2018 by Shubham
• 13,110 points

Related Questions In Apache Spark

0 votes
1 answer

How to set cpu cores for spark task?

By default, each task is allocated with ...READ MORE

answered Mar 12 in Apache Spark by Veer
180 views
0 votes
1 answer

How to give user only view access for Spark application?

You can give users only view permission ...READ MORE

answered Mar 14 in Apache Spark by Raj
13 views
0 votes
1 answer

How to set executors for static allocation in Spark Yarn?

Open Spark shell and run the following ...READ MORE

answered Mar 28 in Apache Spark by Raj
95 views
0 votes
1 answer

How to set extra JVM options for Spark application?

You cans set extra JVM options that ...READ MORE

answered Mar 28 in Apache Spark by Raj
153 views
0 votes
1 answer

Getting error while connecting zookeeper in Kafka - Spark Streaming integration

I guess you need provide this kafka.bootstrap.servers ...READ MORE

answered May 24, 2018 in Apache Spark by Shubham
• 13,110 points
440 views
0 votes
0 answers
0 votes
1 answer

Is it possible to run Apache Spark without Hadoop?

Though Spark and Hadoop were the frameworks designed ...READ MORE

answered May 2 in Big Data Hadoop by ravikiran
• 3,400 points
40 views
0 votes
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 10,030 points
2,037 views
0 votes
3 answers

How to transpose Spark DataFrame?

Please check the below mentioned links for ...READ MORE

answered Dec 31, 2018 in Apache Spark by anonymous
4,173 views
0 votes
4 answers

How to change the spark Session configuration in Pyspark?

You can dynamically load properties. First create ...READ MORE

answered Dec 10, 2018 in Apache Spark by Vini
10,333 views