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
429 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,480 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, 2019 in Apache Spark by Veer
2,142 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, 2019 in Apache Spark by Raj
366 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, 2019 in Apache Spark by Raj
584 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, 2019 in Apache Spark by Raj
1,987 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,480 points
1,551 views
+1 vote
2 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, 2019 in Big Data Hadoop by ravikiran
• 4,620 points
318 views
+1 vote
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
• 11,380 points
6,811 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
14,267 views
0 votes
5 answers

How to change the spark Session configuration in Pyspark?

You aren't actually overwriting anything with this ...READ MORE

answered Dec 13, 2020 in Apache Spark by Gitika
• 65,870 points
49,649 views