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
1,697 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,490 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
4,404 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
1,481 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
1,484 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
3,952 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,490 points
2,790 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 3, 2019 in Big Data Hadoop by ravikiran
• 4,620 points
1,228 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
10,997 views
0 votes
3 answers

How to transpose Spark DataFrame?

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

answered Jan 1, 2019 in Apache Spark by anonymous
19,876 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 14, 2020 in Apache Spark by Gitika
• 65,850 points
125,460 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP