View unanswered posts | View active topics

Reply to topic  [ 4 posts ] 

Joined: Sun Jul 13, 2008 11:40 am
Posts: 36
Location: Slovenija EU
Post Access Connection for standard tags - Python code .. II
.. sorry to open new post but there is constant session error by uploading this post under Access Connection ..

Log file - News tags ...

Bellow you can see log file entries. I attached logActivity hook to the same chanell access export hook is already attached. As you can see there is no news tags in the log (anything as Title, Description etc.). Please advice how I can see awasu ini file contents? I tried again with

import win32api
configFilename = sys.argv[1]
f.open(configFilename, 'r')
INI = f.read()
f.close()
f = open('C:/Documents and Settings/OtonicarA_01/My Documents/BAZA_BORZA/AwasuLogFile.txt', 'r+')
f.write(INI)
f.close()

But no luck. Nothing is exported to TXT file. Again be aware that this chenell is created from search resoults (third option - key word based). Please send me step by step action or send me code sample whith whoch I can finally export INI file to TXT file to see what is in side ...

Log file:
24jul08 20:32:50 | EVENT: ChannelConfigChanged
24jul08 20:32:55 | EVENT: BeginChannelUpdate
24jul08 20:32:58 | EVENT: EndChannelUpdate
24jul08 20:34:01 | EVENT: ChannelConfigChanged
24jul08 20:34:01 | --- BEGIN CONFIG FILE ---
[GlobalChannelHookParameters]
DateStamps=1
TimeStamps=1
[Config]
ChannelHookConfigFilename=C:\Program Files\Awasu_BORZA\ChannelHooks\LogChannelActivity\LogChannelActivity.hook
SettingsFilename=C:\DOCUME~1\OTONIC~1\LOCALS~1\Temp\awasu383
SettingsSectionName=Settings
AppHomeUrl=http://www.awasu.com
AppName=Awasu
AppPluginsDir=C:\Program Files\Awasu_BORZA\AppPlugins
ArchiveDatabase=C:\Program Files\Awasu_BORZA\Users\Federo\archive.db
ChannelsDir=C:\Program Files\Awasu_BORZA\Users\Federo\Channels
HttpUserAgent=Awasu/2.3PRO
UserConfigFile=C:\Program Files\Awasu_BORZA\Users\Federo\config.ini
UserName=Federo
VersionString=2.3
Command=ProcessEvent
EventName=ChannelConfigChanged
LocalChannelId=28
ChannelConfigFile=C:\Program Files\Awasu_BORZA\Users\Federo\Channels\1.channel
hChannelCookie=71604208
hChannelHookCookie=82511200
[ChannelHookParameters]
LogFile=AwasuLog
DumpConfigFiles=1
24jul08 20:34:01 | --- END CONFIG FILE ---
24jul08 20:34:36 | EVENT: ChannelConfigChanged
24jul08 20:34:36 | --- BEGIN CONFIG FILE ---


Thu Jul 24, 2008 11:40 pm
Profile WWW
Site Admin
User avatar

Joined: Fri Feb 07, 2003 8:48 am
Posts: 2899
Location: Melbourne, Australia
Post Re: Access Connection for standard tags - Python code .. II
Otonicara wrote:
Nothing is exported to TXT file.

Try opening your log file with write access.

Otonicara wrote:
Again be aware that this chenell is created from search resoults (third option - key word based).

This makes no difference. The different types of channel only affect how feeds are retrieved. Once they are retrieved and in the system, Awasu doesn't care where they came from.

Otonicara wrote:
As you can see there is no news tags in the log (anything as Title, Description etc.).

You will only get these if the hook is being run to handle a <tt>NewFeedItem</tt> event (note: no "s") or <tt>ConsolidatedNewFeedItems</tt> event. In your other post you said that you changed your hook config to request channel update events so that your hook would get run. So yes, it will get run, <u>when the channel is updated</u>! Awasu can't possibly send through details of new feed items if there aren't any :roll:

The easiest way to get your hook working is to set up a test feed file on your PC and subscribe to that. Attach your hook to the channel and then you can easily trigger new feed item events by adding new items to your feed file and then updating the channel.


Fri Jul 25, 2008 1:38 am
Profile WWW

Joined: Sun Jul 13, 2008 11:40 am
Posts: 36
Location: Slovenija EU
Post Still not working ..
MarketWire Log file example:
[NewFeedItem]
ItemId=11044
ExternalItemId=
ItemTitle=CORRECTION FROM SOURCE: PlayBOX in Negotiations to Acquire New Visions Mobile%0A*0
ItemUrl=http://www.marketwire.com/mw/release.do?id=882770&sourceType=3
TimeCreated=1216986640
ItemFingerprint=bee01dfbf813ee8c142bdaad9c315755
ItemMetadata=<value>CORRECTION FROM SOURCE: PlayBOX in Negotiations to Acquire New Visions Mobile</value><group><value>http://www.marketwire.com/mw/release.do?id=882770&sourceType=3</value></group><group><value>OTC Bulletin Board:PYBX</value><value>http://www.marketwire.com/rss/stock</value></group><value>1216986300</value>
ItemLink1_Uri=http://www.marketwire.com/mw/release.do?id=882770&sourceType=3
ItemLink1_RelType=


Python Code - only important lines:
import sys
import pyodbc
import win32api

configFilename = sys.argv[1]

xTitle = win32api.GetProfileVal( "NewFeedItem" , "ItemTitle" , "" , configFilename )
xURL = win32api.GetProfileVal( "NewFeedItem" , "ItemUrl" , "" , configFilename )

Hook - entire code:
[Config]
ScriptFilename=RSSExportToAccess.py
DisplayName=Save News-Feed Items to Access db
AuthorName=OtonicarA
AuthorEmailAddress=ales@otonicar.com
Notes=This channel hook saves the channel's individual feed items to Access database.

' ---------------------------------------------------------------------

[Events]
NewFeedItem=1
EndChannelUpdate=1

' ---------------------------------------------------------------------


Questions:

1.) How should win32api.GetProfileVal line be written to be able to capture hooked items? Look log file contents. At the moment hooked items are not transferde to access database. Fixed itemes diffined values in py code are tranfered. This means that code is working - is triggered and fiexed data are tranfered. Unfoprtunatlly hooked data are still not transfered!! Be aware that I tested the code on oroginal feed and on feed generated from serach resoults. In ider of cases new Items were not transfered.

2.) For feed tested above I can not find tag category in log file despite you saied this is standard tag. Copy link to Microsoft Explorer and you will see on the right side of the screen categories. What needs to be done to capture this categoty tag in awasu as well? Please send me code sample for extra metadata definition..
RSS: http://new.marketwire.com/rss/BreakingN ... nglish.xml


Fri Aug 01, 2008 4:19 am
Profile WWW
Site Admin
User avatar

Joined: Fri Feb 07, 2003 8:48 am
Posts: 2899
Location: Melbourne, Australia
Post 
Otonicara wrote:
1.) How should win32api.GetProfileVal line be written to be able to capture hooked items?

What you've got is correct. But I notice your hook is registered for both <tt>NewFeedItem</tt> and <tt>EndChannelUpdate</tt> events. This means that your hook will get called every time a new feed item is received *and* every time the channel finishes updating (whether anything new was received or not). In the latter case, there's no point looking for a <tt>[NewFeedItem]</tt> section in the INI file since it won't be there, the format of the file is different. So, unless your hook is written to check which event it is being run for and act accordingly, your code will be looking for details of a new feed item which aren't there.

Otonicara wrote:
2.) For feed tested above I can not find tag category in log file despite you saied this is standard tag.

The feed item you gave is no longer in the feed but if you look at the raw XML, not every item has a category. I think you were just unlucky :-) For items that do have a category assigned, it will appear in the <tt>ItemMetadata</tt> field. It's XML so you'll have to parse it to find and extract the category information (the XML tags have attributes indicating the type of metadata but I think the forum software has stripped them out from your post).


Sat Aug 02, 2008 1:23 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online
Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron