Git Product home page Git Product logo

twolde's People

Contributors

eartle avatar hugovk avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

hugovk

twolde's Issues

"Status is over 140 characters"

Probably not a duplicate of fixed #4.

Next tweet: "! https://t.co/OoMRjuOwei RT @mikko: An MS developer explains in a Reddit thread why Windows 10 is called W
indows 10. http://t.co/8Ev3jekNnH"
Next tweet time: Wed Oct  1 19:47:46 2014 UTC (in 24 minutes, 21 seconds)
Traceback (most recent call last):
  File "twolde.py", line 225, in <module>
    if args.command == "install":
  File "twolde.py", line 221, in main
    help='Number of years in the past')
  File "twolde.py", line 158, in run
    [olde_api, HTMLParser().unescape(next_tweet.text), next_tweet.in_reply_to_status_id])
  File "C:\Python27\lib\sched.py", line 117, in run
    action(*argument)
  File "twolde.py", line 175, in do_tweet

  File "C:\Python27\lib\site-packages\tweepy\api.py", line 193, in update_status
    )(post_data=post_data, *args, **kwargs)
  File "C:\Python27\lib\site-packages\tweepy\binder.py", line 239, in _call
    return method.execute()
  File "C:\Python27\lib\site-packages\tweepy\binder.py", line 223, in execute
    raise TweepError(error_msg, resp)
tweepy.error.TweepError: [{u'message': u'Status is over 140 characters.', u'code': 186}]

Original tweet:
https://twitter.com/hugovk/status/517400498203529216

All these (with expanded or wrapped links) or are indeed one character over limit:

  • ! https://t.co/OoMRjuOwei RT @mikko: An MS developer explains in a Reddit thread why Windows 10 is called Windows 10. http://t.co/8Ev3jekNnH
  • ! https://searchcode.com/?q=startswith+Windows+9 RT @mikko: An MS developer explains in a Reddit thread why Windows 10 is called Windows 10. http://t.co/8Ev3jekNnH
  • ! https://t.co/OoMRjuOwei RT @mikko: An MS developer explains in a Reddit thread why Windows 10 is called Windows 10. https://twitter.com/mikko/status/517358472715710465/photo/1
  • ! https://searchcode.com/?q=startswith+Windows+9 RT @mikko: An MS developer explains in a Reddit thread why Windows 10 is called Windows 10. https://twitter.com/mikko/status/517358472715710465/photo/1

It looks like I squeezed every character out of it. My best guess is that a year ago HTTP links cost 22 chars and HTTPS 23, but now both cost 23.
https://dev.twitter.com/overview/t.co
https://dev.twitter.com/rest/reference/get/help/configuration

These limits will increase in time, so this will be a recurring problem.


Two possible solutions:

  • Skip these problematic tweets
    • -> Easiest way is to catch tweepy.error.TweepError and check the error message.
  • Trim these problematic tweets
    • -> Could still cause problems, for example a tweet ending http://t.co/8Ev3jekNnH trimmed to http://t.co/8Ev3jekNn is still a link and 23 chars.

Thoughts?

"Status is over 140 characters"

Windows 7, cmd.exe, latest master of Twolde.

Next tweet: "@Alby "It's more than just a typo This is a completely diff. [symbol] with a diff. meaning &amp; complet
ely changes the way the formula works""
Next tweet time: Thu Apr 10 21:36:56 2014 UTC (in 285.329 seconds)
Traceback (most recent call last):
  File "twolde.py", line 219, in <module>
    elif sys.argv[1] == "run":
  File "twolde.py", line 186, in run

  File "C:\Python27\lib\sched.py", line 117, in run
    action(*argument)
  File "twolde.py", line 207, in do_tweet
    def do_tweet(api, text, in_reply_to_status_id):
  File "C:\Python27\lib\site-packages\tweepy\api.py", line 193, in update_status
    )(post_data=post_data, *args, **kwargs)
  File "C:\Python27\lib\site-packages\tweepy\binder.py", line 239, in _call
    return method.execute()
  File "C:\Python27\lib\site-packages\tweepy\binder.py", line 223, in execute
    raise TweepError(error_msg, resp)
tweepy.error.TweepError: [{u'message': u'Status is over 140 characters.', u'code': 186}]

The original tweet:

@alby "It's more than just a typo… This is a completely diff. [symbol] with a diff. meaning & completely changes the way the formula works"

https://twitter.com/hugovk/statuses/454372484037771264

The attempted tweet was four characters too long. The original had one to spare.

 was really and &amp; was really &.

Aborted connection error

I got an aborted connection error. I've only seen this once:

Next tweet time: Tue May  6 05:35:05 2014 UTC (in 29292.304 seconds)
Traceback (most recent call last):
  File "twolde.py", line 220, in <module>
    run()
  File "twolde.py", line 187, in run
    s.run()
  File "C:\Python27\lib\sched.py", line 117, in run
    action(*argument)
  File "twolde.py", line 204, in do_retweet
    api.retweet(id=id)
  File "C:\Python27\lib\site-packages\tweepy\binder.py", line 239, in _call
    return method.execute()
  File "C:\Python27\lib\site-packages\tweepy\binder.py", line 189, in execute
    raise TweepError('Failed to send request: %s' % e)
tweepy.error.TweepError: Failed to send request: ('Connection aborted.', gaierror(11004, 'getaddrinfo failed'))

Perhaps a try: ... except tweepy.error.TweepError: is in order, and perhaps for a greater range of exceptions. On exception, print error and either try again X times, or just skip it and carry on.

Duplicate status error

Next tweet: "@OED @OxfordWords "Twitter Posting 25 Aug. in twitter. com (O.E.D. Archive)" is like crediting a book's pub
lisher but not the author."
Next tweet time: Wed Jul  2 11:53:52 2014 UTC (in 4 minutes, 17 seconds)
Next tweet: "GOOD NEWS! I lost the key for my old bicycle in the snow four years ago but I just found the spare in a sho
ebox at the back of a cupboard!"
Next tweet time: Wed Jul  2 18:21:25 2014 UTC (in 6 hours, 27 minutes, 32 seconds)
Traceback (most recent call last):
  File "C:\Users\hugovk\github\twolde\twolde.py", line 234, in <module>
    run()
  File "C:\Users\hugovk\github\twolde\twolde.py", line 185, in run
    s.run()
  File "C:\Python27\lib\sched.py", line 117, in run
    action(*argument)
  File "C:\Users\hugovk\github\twolde\twolde.py", line 206, in do_tweet
    api.update_status(status=text, in_reply_to_status_id=in_reply_to_status_id)
  File "C:\Python27\lib\site-packages\tweepy\api.py", line 193, in update_status
    )(post_data=post_data, *args, **kwargs)
  File "C:\Python27\lib\site-packages\tweepy\binder.py", line 239, in _call
    return method.execute()
  File "C:\Python27\lib\site-packages\tweepy\binder.py", line 223, in execute
    raise TweepError(error_msg, resp)
tweepy.error.TweepError: [{u'message': u'Status is a duplicate.', u'code': 187}]

That first one was posted and is the last one posted, but the second one didn't make it.

Doesn't look like a duplicate to me.

Anyway, perhaps a try: ... except tweepy.error.TweepError: is in order, and perhaps for a greater range of exceptions. On exception, print error and either try again X times, or just skip it and carry on.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.