Skip to content

Conversation

JChristensen
Copy link
Contributor

About a week ago, the arduino-tweet.appspot.com site started returning HTTP/1.0 403 Forbidden. Adding the HTTP "Host" header seems to fix this.

@NeoCat
Copy link
Owner

NeoCat commented Dec 15, 2018

Thanks! LGTM.

@NeoCat NeoCat merged commit fe04617 into NeoCat:master Dec 15, 2018
@JChristensen
Copy link
Contributor Author

Just curious, are you aware of anyone else having this issue? A friend and I both had it but I was surprised when I checked the Arduino forum, I didn't find anyone else reporting it.
Cheers!

@beni9n
Copy link

beni9n commented Jan 7, 2019

Hello. Thank you for fixing the 403 error! I really appreciate it.

Though the tweets are now sending, I'm having an issue:

twitter.wait() is hanging for four minutes before returning the HTTP status code.

Here's a snippet of my code:

boolean sendTweet(char* hashtag, char* tag, boolean open){ 
  if(open){
    delay(500);                                                  
    strcpy(tweet, msg_OPEN);                  
    strcat(tweet, hashtag);
    strcat(tweet, msg_asOf);
    if (hour12 > 9)                                                                  
      strcat(tweet, " ");  
    strcat(tweet, timestamp);  
    strcat(tweet, tag);
  } else {
    delay(500);                                                  
    strcpy(tweet, hashtag);
    strcat(tweet, msg_asOf);
    if (hour12 > 9)
      strcat(tweet, " ");
    strcat(tweet, timestamp);
    strcat(tweet, tag);
  }
  lcd.clear();                                                                         
  if (twitter.post(tweet)) {
    Serial.println("Tweet sent");
    Serial.println("About to check twitter.wait()");
    status = twitter.wait();
    Serial.println("twitter.wait() checked");
    Serial.print("Status: ");
    Serial.println(status);

    if (status == 200) {
      lcd.print("Tweet sent!");
   Serial.println("Tweet sent");
      lcd.setCursor(0,2);                                                                        
      lcd.print(statusString);
      delay(2000);
      return 1;
    } else {
      lcd.clear();
      lcd.print("Failure! Error ");                        
      lcd.print(status);
      delay(2000);                                                                      
      strcpy(statusString, "ERROR Tweet not sent");
      lcd.setCursor(0,2);                                                                        
      lcd.print(statusString);
      lcd.setCursor(0,3);
      lcd.print("Wait 1 min ");                                  
      // one minute required by NeoCat  
      delay(60000);
      
      return 0;
    }
  } else {
    lcd.clear();
    lcd.print("Connection failed.");
    delay(2000);
    strcpy(statusString, "ERROR Tweet not sent");    
    return 0;
  }  
}

Here is the serial output:

Tweet sent
About to check twitter.wait()
twitter.wait() checked
Status: 200
Tweet sent

The time between "About to check twitter.wait()" and "twitter.wait() checked" appears to be exactly 4 minutes. Is it a problem with my code or are others experiencing this?

Thanks again,
Jeremy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants