Loading ...
Sorry, an error occurred while loading the content.

1087Re: [smartsockets] RE: RSS reader thread...

Expand Messages
  • Rich Gopstein
    Oct 1, 2013
    • 0 Attachment
      I uploaded twitter-api-example.py to the files section of the group.  It might be a little cryptic - so ask if you have any questions.  It tracks tweets about the Yankees and outputs the handle of the tweeter, the language of the tweet, and the tweet text.

      I'm not sure how you would deal with the API keys problem - that's a good question.  I guess asking the user to register on the first use would be a good option.

      Rich



      On Tue, Oct 1, 2013 at 2:22 PM, <fixitsan@...> wrote:
       

       

      Yah, but yoiu know the problem now. Featurecreep.
       
      If I use f = urllib.urlopen('<RSS feed url from the BBC>'), and then scrape through the returned file for incidences of '<item>' I can easily get RSS feeds working too.
       
      And the problem with that is there are different flavours of script languages being used for RSS, so I need to make sure that I capture the header, and then , hopefully, there might be a Python module already built to deal with it !
       
      Chris
       
       
       
      sounds great..cant wait till it functions on a smart socket array...kp couch
       
      In a message dated 10/1/2013 10:55:46 A.M. Pacific Daylight Time, fixitsan@... writes:
       

       

      No I didn't need to go that far Rich. Opening Python 2.x with IDLE (not Python 3.x with IDLE3) I just used the inbuilt 'urlopen'
       
      As long as the public feed is accessible without logging into Twitter, IE it is available through a regular browser without logging into Twitter, EG https:// twitter.com/bbcnews , then URLLIB does all the SSL stuff required.
       
      I used ..
       
      import urllib
       
       
       
      f = urllib.urlopen('https://twitter.com/bbcnews')
      print (f.read())
       
       
       
       
      OKay, including the line 'import urllib' then it's 3 lines of code
       
      Replacing'BBCNews' with 'NYTimes' also works.
       
      The caveat, apparently, is that SSL isn't checking security certificates using this method
       
       
      Chris
       
       
       
       
       
       
       
      Are you calling an eternal executable to get the twitter feed, or did you register an app with twitter and connect yourself using the twitter API? (can't imagine you could do that in two lines of code, though)...

      If you are worried about someone getting your source code, use a compiled language instead of Python.

      Rich



      On Tue, Oct 1, 2013 at 9:30 AM, <fixitsan@...> wrote:
       

       I've gone from a RF 802.11 module + pic + sd card + breadboard + hundreds of lines of difficult code

       

      To A Raspberry Pi, and 2 , TWO, lines of code.

       

      In fact, I am able to get an HTTPS (secured with SSL) off a public Twitter feed, www.twitter.com/bbcnews , and send the output straight to the screen.

       

      But with a few more lines the Twitter page can go straight to a file for processing and scraping.

       

       

      I think that this is the way forward for me, at least for now. A model 'A' Raspberry Pi board costs £22 (+vat), when you add the £5.50 for the wifi dongle it still comes in at under £30. That's probably less than buying the microcontroller solution I was previously working on.

       

      RaspPi's only disadvantages are that it's larger and the code cannot be secured (flashed onto a chip with protection bits set), Neither of those are too offensive considering the opportunities it brings in return.

       

      I like the fact that I can just 'get on with programming' without getting too tied up with the technicalities. It sort of reminds me of when I used to spend hours writing shareware for the Psion Organiser using OPL. Python seems just as good at getting the job done.

       

       

      Hehe, 2 lines of code versus over 1000 !

       

       

       

       

       

       

       

       

       



      ---In smartsockets@yahoogroups.com, <michail1@...> wrote:

      I have been mining Bitcoin using raspberry pi's for a while.
      I can confirm that memory cards make a huge diff.  (So, I keep several with images pre-setup just in case they go bad.)  Strangely, I have the worse luck with Sandisk.
       
      I typically don't use with monitors, but when I do, I use the cheap $7 HDMI to VGA adapters.
       
      Next time you buy a pi, just add the $5 to get the 8GB card with it.  Cheaper than you can buy in a store and come loaded with the OS'es preloaded.
       
      Michail
       
      In a message dated 9/26/2013 4:07:10 P.M. Pacific Daylight Time, fixitsan@... writes:

       Hello from my Raspberry Pi !


      I have to say that I didn't expect to have so many problems with SD Cards from different manufacturers, But in the end I've booted up successfully  from an old Sandisk 2GB.


      Wifi installation was painless, and I'm reading this back in a browser window displayed on my monitor via it's DVI input through an HDMI to DVI cable, between the monitor and the Pi.


      In one USB slot is the small wifi dongle, in the other USB slot is my industrial keyboard with built in mouse.



      I've rebooted a couple of times and the hardware comes up well each time so I'm on the way now. I've never touched python, I had a couple of African pythons as pets when I was a teenager but thats about it !



      So now I need to do some research and start playing about.....hoping for a quiet day at work tomorrow, but at least the weekend is here anyway :)



      Chris



    • Show all 62 messages in this topic