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
113 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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
• 12,810 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
129 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
6 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
78 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
97 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
• 12,810 points
386 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
• 2,280 points
27 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
• 9,450 points
1,843 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
3,650 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
8,895 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.