When I search API.mentions_timeline why are my results inconsistent?Python join: why is it string.join(list) instead of list.join(string)?What is a mixin, and why are they useful?Why are Python lambdas useful?Why does comparing strings using either '==' or 'is' sometimes produce a different result?Why do people write the #!/usr/bin/env python shebang on the first line of a Python script?Why can't Python parse this JSON data?Why use pip over easy_install?Why is reading lines from stdin much slower in C++ than Python?Why does Python code run faster in a function?Why is “1000000000000000 in range(1000000000000001)” so fast in Python 3?
empApi with Lightning Web Components?
What is the logic behind charging tax _in the form of money_ for owning property when the property does not produce money?
Please figure out this Pan digital Prince
How do we say "within a kilometer radius spherically"?
Grep Match and extract
How to avoid typing 'git' at the begining of every Git command
What would be the way to say "just saying" in German? (Not the literal translation)
How can I remove material from this wood beam?
Is it possible to have 2 different but equal size real number sets that have the same mean and standard deviation?
Getting UPS Power from One Room to Another
Does the Nuka-Cola bottler actually generate nuka cola?
60s or 70s novel about Empire of Man making 1st contact with 1st discovered alien race
bash vs. zsh: What are the practical differences?
Increase speed altering column on large table to NON NULL
Should I put programming books I wrote a few years ago on my resume?
What does the pair of vertical lines in empirical entropy formula mean?
I've been given a project I can't complete, what should I do?
tabular: caption and align problem
Fermat's statement about the ancients: How serious was he?
Why do radiation hardened IC packages often have long leads?
Write a function that checks if a string starts with or contains something
Who is "He that flies" in Lord of the Rings?
Is it safe to change the harddrive power feature so that it never turns off?
Does putting salt first make it easier for attacker to bruteforce the hash?
When I search API.mentions_timeline why are my results inconsistent?
Python join: why is it string.join(list) instead of list.join(string)?What is a mixin, and why are they useful?Why are Python lambdas useful?Why does comparing strings using either '==' or 'is' sometimes produce a different result?Why do people write the #!/usr/bin/env python shebang on the first line of a Python script?Why can't Python parse this JSON data?Why use pip over easy_install?Why is reading lines from stdin much slower in C++ than Python?Why does Python code run faster in a function?Why is “1000000000000000 in range(1000000000000001)” so fast in Python 3?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I'm using three if statements to search my mentions for three specific phrases. Some of the time matches are found but most of the time they are ignored.
I can't see anything out of place here. When I use similar code with another Twitter account to search for different phrases those matches are always found.
Here's the python code that searches mentions & replies. If the rest is needed for context let me know so I can edit my question.
def reply_to_tweets():
print('retrieving and replying to tweets...')
last_seen_id = retrieve_last_seen_id(file_name)
mentions = api.mentions_timeline(last_seen_id, tweet_mode='extended')
for mention in reversed(mentions):
print(str(mention.id) + ' - ' + mention.full_text)
last_seen_id = mention.id
store_last_seen_id(last_seen_id, file_name)
if 'that's a million bucks' in mention.full_text.lower():
print('replying about AirMiles')
api.update_status('@' + mention.user.screen_name + ' Just swipe your AirMiles card to enter.', mention.id)
if 'fruit is always so fresh' in mention.full_text.lower():
print('replying about shopping')
api.update_status('@' + mention.user.screen_name + ' Cassie, are you shopping?', mention.id)
if 'i play to win gord' in mention.full_text.lower():
print('replying about Sobeys and Safeway')
api.update_status('@' + mention.user.screen_name + ' And that's why it pays to shop at Sobeys and Safeway.', mention.id)
When someone tweets @ my account with that's a million bucks I expect python to reply with Just swipe your air miles card to enter. Occasionally this happens but usually it doesn't.
When someone tweets @ my account with fruit is always so fresh I expect python to reply with Cassie, are you shopping? Occasionally this happens but usually it doesn't.
When someone tweets @ my account with I play to win Gord. I expect python to reply with And that's why it pays to shop with Sobeys and Safeway. Occasionally this happens but usually it doesn't.
python tweepy
|
show 1 more comment
I'm using three if statements to search my mentions for three specific phrases. Some of the time matches are found but most of the time they are ignored.
I can't see anything out of place here. When I use similar code with another Twitter account to search for different phrases those matches are always found.
Here's the python code that searches mentions & replies. If the rest is needed for context let me know so I can edit my question.
def reply_to_tweets():
print('retrieving and replying to tweets...')
last_seen_id = retrieve_last_seen_id(file_name)
mentions = api.mentions_timeline(last_seen_id, tweet_mode='extended')
for mention in reversed(mentions):
print(str(mention.id) + ' - ' + mention.full_text)
last_seen_id = mention.id
store_last_seen_id(last_seen_id, file_name)
if 'that's a million bucks' in mention.full_text.lower():
print('replying about AirMiles')
api.update_status('@' + mention.user.screen_name + ' Just swipe your AirMiles card to enter.', mention.id)
if 'fruit is always so fresh' in mention.full_text.lower():
print('replying about shopping')
api.update_status('@' + mention.user.screen_name + ' Cassie, are you shopping?', mention.id)
if 'i play to win gord' in mention.full_text.lower():
print('replying about Sobeys and Safeway')
api.update_status('@' + mention.user.screen_name + ' And that's why it pays to shop at Sobeys and Safeway.', mention.id)
When someone tweets @ my account with that's a million bucks I expect python to reply with Just swipe your air miles card to enter. Occasionally this happens but usually it doesn't.
When someone tweets @ my account with fruit is always so fresh I expect python to reply with Cassie, are you shopping? Occasionally this happens but usually it doesn't.
When someone tweets @ my account with I play to win Gord. I expect python to reply with And that's why it pays to shop with Sobeys and Safeway. Occasionally this happens but usually it doesn't.
python tweepy
You print out mention.full_text before you apply your comparisons. Do you see text that should be matched by your comparisons? - you should show us your output. - from the output, it should be pretty obvious what's going on.
– Steve
Mar 26 at 0:59
1
You miss my point. When you run your code, you may or may not see a match cause a "replying about..." string to be printed, but you should ALWAYS see the text you're searching through printed, because you are printing that unconditionally. So what I want to see is output where the string in mention.full_text is printed out, and so you can see that it should match, but then it doesn't.
– Steve
Mar 26 at 1:29
1
Oh...really...NOTHING is printed? If that's the case, then your api.mentions_timeline call is simply returning no values in those cases. You say "Some of the time matches are found but most of the time they are ignored". That's not true if you get no output. If you get no output, then no matches were ignored...rather, there was nothing returned to match against.
– Steve
Mar 26 at 1:32
Pardon me Steve. I was working from memory and described the output poorly. Unfortunately the wifi here is way to slow to connect to Twitter properly & test. As soon as I can run it I'll update the question to show the output. The mentions were printed followed by a description of what was done if a match was found. When the matching text wasn't picked up by my code only the mention was printed.
– mike_yung
Mar 26 at 1:39
1
Cool. I want to see that case where the mention was printed but no match was printed. If the text looks like a match should have occurred, then something really strange is going on. You're doing the right thing with your print statements to try to figure this out.
– Steve
Mar 26 at 1:42
|
show 1 more comment
I'm using three if statements to search my mentions for three specific phrases. Some of the time matches are found but most of the time they are ignored.
I can't see anything out of place here. When I use similar code with another Twitter account to search for different phrases those matches are always found.
Here's the python code that searches mentions & replies. If the rest is needed for context let me know so I can edit my question.
def reply_to_tweets():
print('retrieving and replying to tweets...')
last_seen_id = retrieve_last_seen_id(file_name)
mentions = api.mentions_timeline(last_seen_id, tweet_mode='extended')
for mention in reversed(mentions):
print(str(mention.id) + ' - ' + mention.full_text)
last_seen_id = mention.id
store_last_seen_id(last_seen_id, file_name)
if 'that's a million bucks' in mention.full_text.lower():
print('replying about AirMiles')
api.update_status('@' + mention.user.screen_name + ' Just swipe your AirMiles card to enter.', mention.id)
if 'fruit is always so fresh' in mention.full_text.lower():
print('replying about shopping')
api.update_status('@' + mention.user.screen_name + ' Cassie, are you shopping?', mention.id)
if 'i play to win gord' in mention.full_text.lower():
print('replying about Sobeys and Safeway')
api.update_status('@' + mention.user.screen_name + ' And that's why it pays to shop at Sobeys and Safeway.', mention.id)
When someone tweets @ my account with that's a million bucks I expect python to reply with Just swipe your air miles card to enter. Occasionally this happens but usually it doesn't.
When someone tweets @ my account with fruit is always so fresh I expect python to reply with Cassie, are you shopping? Occasionally this happens but usually it doesn't.
When someone tweets @ my account with I play to win Gord. I expect python to reply with And that's why it pays to shop with Sobeys and Safeway. Occasionally this happens but usually it doesn't.
python tweepy
I'm using three if statements to search my mentions for three specific phrases. Some of the time matches are found but most of the time they are ignored.
I can't see anything out of place here. When I use similar code with another Twitter account to search for different phrases those matches are always found.
Here's the python code that searches mentions & replies. If the rest is needed for context let me know so I can edit my question.
def reply_to_tweets():
print('retrieving and replying to tweets...')
last_seen_id = retrieve_last_seen_id(file_name)
mentions = api.mentions_timeline(last_seen_id, tweet_mode='extended')
for mention in reversed(mentions):
print(str(mention.id) + ' - ' + mention.full_text)
last_seen_id = mention.id
store_last_seen_id(last_seen_id, file_name)
if 'that's a million bucks' in mention.full_text.lower():
print('replying about AirMiles')
api.update_status('@' + mention.user.screen_name + ' Just swipe your AirMiles card to enter.', mention.id)
if 'fruit is always so fresh' in mention.full_text.lower():
print('replying about shopping')
api.update_status('@' + mention.user.screen_name + ' Cassie, are you shopping?', mention.id)
if 'i play to win gord' in mention.full_text.lower():
print('replying about Sobeys and Safeway')
api.update_status('@' + mention.user.screen_name + ' And that's why it pays to shop at Sobeys and Safeway.', mention.id)
When someone tweets @ my account with that's a million bucks I expect python to reply with Just swipe your air miles card to enter. Occasionally this happens but usually it doesn't.
When someone tweets @ my account with fruit is always so fresh I expect python to reply with Cassie, are you shopping? Occasionally this happens but usually it doesn't.
When someone tweets @ my account with I play to win Gord. I expect python to reply with And that's why it pays to shop with Sobeys and Safeway. Occasionally this happens but usually it doesn't.
python tweepy
python tweepy
edited Mar 26 at 0:46
mike_yung
asked Mar 24 at 20:18
mike_yungmike_yung
379
379
You print out mention.full_text before you apply your comparisons. Do you see text that should be matched by your comparisons? - you should show us your output. - from the output, it should be pretty obvious what's going on.
– Steve
Mar 26 at 0:59
1
You miss my point. When you run your code, you may or may not see a match cause a "replying about..." string to be printed, but you should ALWAYS see the text you're searching through printed, because you are printing that unconditionally. So what I want to see is output where the string in mention.full_text is printed out, and so you can see that it should match, but then it doesn't.
– Steve
Mar 26 at 1:29
1
Oh...really...NOTHING is printed? If that's the case, then your api.mentions_timeline call is simply returning no values in those cases. You say "Some of the time matches are found but most of the time they are ignored". That's not true if you get no output. If you get no output, then no matches were ignored...rather, there was nothing returned to match against.
– Steve
Mar 26 at 1:32
Pardon me Steve. I was working from memory and described the output poorly. Unfortunately the wifi here is way to slow to connect to Twitter properly & test. As soon as I can run it I'll update the question to show the output. The mentions were printed followed by a description of what was done if a match was found. When the matching text wasn't picked up by my code only the mention was printed.
– mike_yung
Mar 26 at 1:39
1
Cool. I want to see that case where the mention was printed but no match was printed. If the text looks like a match should have occurred, then something really strange is going on. You're doing the right thing with your print statements to try to figure this out.
– Steve
Mar 26 at 1:42
|
show 1 more comment
You print out mention.full_text before you apply your comparisons. Do you see text that should be matched by your comparisons? - you should show us your output. - from the output, it should be pretty obvious what's going on.
– Steve
Mar 26 at 0:59
1
You miss my point. When you run your code, you may or may not see a match cause a "replying about..." string to be printed, but you should ALWAYS see the text you're searching through printed, because you are printing that unconditionally. So what I want to see is output where the string in mention.full_text is printed out, and so you can see that it should match, but then it doesn't.
– Steve
Mar 26 at 1:29
1
Oh...really...NOTHING is printed? If that's the case, then your api.mentions_timeline call is simply returning no values in those cases. You say "Some of the time matches are found but most of the time they are ignored". That's not true if you get no output. If you get no output, then no matches were ignored...rather, there was nothing returned to match against.
– Steve
Mar 26 at 1:32
Pardon me Steve. I was working from memory and described the output poorly. Unfortunately the wifi here is way to slow to connect to Twitter properly & test. As soon as I can run it I'll update the question to show the output. The mentions were printed followed by a description of what was done if a match was found. When the matching text wasn't picked up by my code only the mention was printed.
– mike_yung
Mar 26 at 1:39
1
Cool. I want to see that case where the mention was printed but no match was printed. If the text looks like a match should have occurred, then something really strange is going on. You're doing the right thing with your print statements to try to figure this out.
– Steve
Mar 26 at 1:42
You print out mention.full_text before you apply your comparisons. Do you see text that should be matched by your comparisons? - you should show us your output. - from the output, it should be pretty obvious what's going on.
– Steve
Mar 26 at 0:59
You print out mention.full_text before you apply your comparisons. Do you see text that should be matched by your comparisons? - you should show us your output. - from the output, it should be pretty obvious what's going on.
– Steve
Mar 26 at 0:59
1
1
You miss my point. When you run your code, you may or may not see a match cause a "replying about..." string to be printed, but you should ALWAYS see the text you're searching through printed, because you are printing that unconditionally. So what I want to see is output where the string in mention.full_text is printed out, and so you can see that it should match, but then it doesn't.
– Steve
Mar 26 at 1:29
You miss my point. When you run your code, you may or may not see a match cause a "replying about..." string to be printed, but you should ALWAYS see the text you're searching through printed, because you are printing that unconditionally. So what I want to see is output where the string in mention.full_text is printed out, and so you can see that it should match, but then it doesn't.
– Steve
Mar 26 at 1:29
1
1
Oh...really...NOTHING is printed? If that's the case, then your api.mentions_timeline call is simply returning no values in those cases. You say "Some of the time matches are found but most of the time they are ignored". That's not true if you get no output. If you get no output, then no matches were ignored...rather, there was nothing returned to match against.
– Steve
Mar 26 at 1:32
Oh...really...NOTHING is printed? If that's the case, then your api.mentions_timeline call is simply returning no values in those cases. You say "Some of the time matches are found but most of the time they are ignored". That's not true if you get no output. If you get no output, then no matches were ignored...rather, there was nothing returned to match against.
– Steve
Mar 26 at 1:32
Pardon me Steve. I was working from memory and described the output poorly. Unfortunately the wifi here is way to slow to connect to Twitter properly & test. As soon as I can run it I'll update the question to show the output. The mentions were printed followed by a description of what was done if a match was found. When the matching text wasn't picked up by my code only the mention was printed.
– mike_yung
Mar 26 at 1:39
Pardon me Steve. I was working from memory and described the output poorly. Unfortunately the wifi here is way to slow to connect to Twitter properly & test. As soon as I can run it I'll update the question to show the output. The mentions were printed followed by a description of what was done if a match was found. When the matching text wasn't picked up by my code only the mention was printed.
– mike_yung
Mar 26 at 1:39
1
1
Cool. I want to see that case where the mention was printed but no match was printed. If the text looks like a match should have occurred, then something really strange is going on. You're doing the right thing with your print statements to try to figure this out.
– Steve
Mar 26 at 1:42
Cool. I want to see that case where the mention was printed but no match was printed. If the text looks like a match should have occurred, then something really strange is going on. You're doing the right thing with your print statements to try to figure this out.
– Steve
Mar 26 at 1:42
|
show 1 more comment
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55328164%2fwhen-i-search-api-mentions-timeline-why-are-my-results-inconsistent%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55328164%2fwhen-i-search-api-mentions-timeline-why-are-my-results-inconsistent%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You print out mention.full_text before you apply your comparisons. Do you see text that should be matched by your comparisons? - you should show us your output. - from the output, it should be pretty obvious what's going on.
– Steve
Mar 26 at 0:59
1
You miss my point. When you run your code, you may or may not see a match cause a "replying about..." string to be printed, but you should ALWAYS see the text you're searching through printed, because you are printing that unconditionally. So what I want to see is output where the string in mention.full_text is printed out, and so you can see that it should match, but then it doesn't.
– Steve
Mar 26 at 1:29
1
Oh...really...NOTHING is printed? If that's the case, then your api.mentions_timeline call is simply returning no values in those cases. You say "Some of the time matches are found but most of the time they are ignored". That's not true if you get no output. If you get no output, then no matches were ignored...rather, there was nothing returned to match against.
– Steve
Mar 26 at 1:32
Pardon me Steve. I was working from memory and described the output poorly. Unfortunately the wifi here is way to slow to connect to Twitter properly & test. As soon as I can run it I'll update the question to show the output. The mentions were printed followed by a description of what was done if a match was found. When the matching text wasn't picked up by my code only the mention was printed.
– mike_yung
Mar 26 at 1:39
1
Cool. I want to see that case where the mention was printed but no match was printed. If the text looks like a match should have occurred, then something really strange is going on. You're doing the right thing with your print statements to try to figure this out.
– Steve
Mar 26 at 1:42