Problem while bringing Google Calendar events to Oracle Tables

Hi Friends,
I have written the following code to bring the Google Calendar Events to Oracle Tables...
CREATE OR REPLACE procedure XX_DEV.authenticate_service_test(p_email in varchar2,p_password in varchar2)
is
l_request utl_http.req;
l_response utl_http.resp;
l_params varchar2(255);
l_resp_data VARCHAR2(4000);-- CHARACTER SET;
l_auth_token VARCHAR2(4000);
l_cal_entry CLOB;
v_response_xml XMLType;
v_entry_id varchar2(100);
xml_result xmltype;
cnt number:= 0;
v_xmldoc CLOB;
v_start_time date;
v_end_time date;
cursor c1 is select x.title title, x.content content, x.where where, x.start_time start_time, x.end_time end_time, x.entry_id entry_id from
xmltable('feed/entry'
passing xmltype(v_xmldoc)
columns title varchar2(1000) path '/entry/title/text()'
,content clob path '/entry/content/text()'
,where clob path '/entry/gd-where/@valueString'
,start_time varchar2(100) path '/entry/gd-when/@startTime'
,end_time varchar2(100) path '/entry/gd-when/@endTime'
,entry_id varchar2(1000) path '/entry/id'
) x ;
begin
-- access the oracle wallet to allow us to make an https request
utl_http.set_wallet(path => 'file:/u01/app/oracle/product/11.2.0/owm/wallets/oracle11/',password => 'srisys123');
-- set up the request body with our credentials
l_params := 'Email=' || p_email || '&Passwd=' || p_password ||'&service=cl' || '&source=e-DBA-test-1.0';
l_request := utl_http.begin_request('https://www.google.com/accounts/ClientLogin','POST','HTTP/1.1');--accounts/ClientLogin
-- set the request headers
utl_http.set_header(l_request,'Content-Type','application/x-www-form-urlencoded');
utl_http.set_header(l_request,'Content-Length',length(l_params));
-- write out the request body
utl_http.write_text( l_request, l_params );
-- get the response
l_response := utl_http.get_response( r => l_request );
dbms_output.put_line('Status Code: '||l_response.status_code);
loop
utl_http.read_line( r => l_response, data => l_resp_data, remove_crlf => TRUE);
dbms_output.put_line(l_resp_data);
if substr(l_resp_data, 1, 5) = 'Auth=' then
l_auth_token := substr(l_resp_data, 6);
end if;
end loop;
exception
when utl_http.end_of_body then
null;
dbms_output.put_line('Auth Token: '||l_auth_token);
utl_http.end_response ( l_response );
-- replace the substitution variables in the template with the parameter values
--utl_http.end_response ( l_response );
l_request := utl_http.begin_request(
'http://www.google.com/calendar/feeds/default/private/full',
'GET',
'HTTP/1.1');
utl_http.set_header(
l_request,
'Content-Type',
'application/atom+xml');
utl_http.set_header(
l_request,
'Authorization',
'GoogleLogin auth='||l_auth_token);
l_response := utl_http.get_response( r => l_request );
utl_http.read_text(
l_response,
l_cal_entry
dbms_output.put_line('Status Code: ' || l_response.status_code);
/*select replace(l_cal_entry,'<?xml version='||'''1.0'''||' encoding='||'''UTF-8'''||'?>','') into l_cal_entry from dual;
select ltrim(l_cal_entry,substr(l_cal_entry,1,148)) into l_cal_entry from dual;
select '<feed'||l_cal_entry into l_cal_entry from dual;
select replace (l_cal_entry,':','-') into l_cal_entry from dual;*/
dbms_output.put_line('Calendar Event: ' || l_cal_entry);
-- xml_result :=XMLType.extract(l_cal_entry,'//title');
delete from xml_test1;
insert into xml_test1 values (l_cal_entry);
utl_http.end_response ( l_response );
select DATA into v_xmldoc from XML_TEST1;
execute immediate 'alter session set events = ''31156 trace name context forever, level 2''';
for i in c1
loop
l_cal_entry:= NULL;
dbms_output.put_line('Result: '||i.title||'*'||i.content||'*'||i.name||'*'||i.start_time||'*'||i.end_time||'*'||i.entry_id);
begin
select 1 into cnt from events_bkp where entry_id = i.entry_id;
select nvl(to_date(rtrim(replace(i.start_time,'T',' '),substr(replace(i.start_time,'T',' '),12,20))||
replace(substr(replace(i.start_time,'T',' '),12,8),'-',':'),'yyyy-mm-dd hh24:mi:ss'),sysdate) into v_start_time from dual;
select nvl(to_date(rtrim(replace(i.end_time,'T',' '),substr(replace(i.end_time,'T',' '),12,20))||
replace(substr(replace(i.end_time,'T',' '),12,8),'-',':'),'yyyy-mm-dd hh24:mi:ss'),sysdate) into v_end_time from dual;
update events_bkp set description = i.title, notes = nvl(i.content,'No Notes'), start_date_time = v_start_time, end_date_time = v_end_time
where entry_id = i.entry_id;
exception when others then
select nvl(to_date(rtrim(replace(i.start_time,'T',' '),substr(replace(i.start_time,'T',' '),12,20))||
replace(substr(replace(i.start_time,'T',' '),12,8),'-',':'),'yyyy-mm-dd hh24:mi:ss'),sysdate) into v_start_time from dual;
select nvl(to_date(rtrim(replace(i.end_time,'T',' '),substr(replace(i.end_time,'T',' '),12,20))||
replace(substr(replace(i.end_time,'T',' '),12,8),'-',':'),'yyyy-mm-dd hh24:mi:ss'),sysdate) into v_end_time from dual;
insert into events_bkp values(events_seq.nextval, 9, 1,1, 4, i.title, nvl(i.content,'No Notes'), v_start_time, v_end_time,'','',
4, 1, sysdate, 1, sysdate, 13, i.entry_id);
end;
commit;
end loop;
execute immediate 'alter session set events = ''31156 trace name context off''';
end authenticate_service_test;
I am able to execute it successfully with my username and password but I am getting error when the number of events are more than 15...
The parameter l_cal_entry which is of clob datatype is not holding the whole xml data.
Please advice....
Thank You,
Srikanth

Hi Friends,
Now I am able to load all the events of a user by adding the following code
loop
utl_http.read_text(l_response, l_cal);
l_cal_entry:= l_cal_entry||l_cal;
end loop;
but I am getting problem when the user has more than one calendar. The Begin_request link I am using is...
'https://www.google.com/calendar/feeds/default/private/full'
Using this, I am able to get only the events of a default calendar associated to the user.
How can I get the events of all calendars or a particular calendar associated with the user.
I may have to change the above link... I have tried with various combinations by appending calendar id but I am unable get the right combination
Please advice...
Thank You,
Srikanth

Similar Messages

  • Google calendar event times are shown as -1h

    Summary:
    When I create a new event in the built in WP8 calendar app to a Google calendar the time of the event is being displayed as one hour earlier.
    Steps to reproduce:
    Create a new event in calendar. Choose one of the Google calendars configured (I have two configured in my phone). Set time as 2013/07/17 16:00. Save the event.
    Expected behavior:
    The event time in the agenda view is shown as 2013/07/17 16:00.
    Observed behavior:
    The event time in the agenda view is shown as 2013/07/17 16:00 for a few seconds. It then automatically changes to 2013/07/17 15:00.
    Other notes:
    I have two Google calendars configured. I can observe the same misbehavior on both.
    I also have a Microsoft (@hotmail.com) calendar configured. This works as expected.
    When I log into my Google calendar using a web browser, the time is shown as expected.
    When I use a third party calendar (Chronos) and sync my Google account directly, the time is shown as expected.
    When I use a third party calendar (Chronos) and use it simply as an interface to the built in WP calendar the time is off again showing 2013/07/17 15:00.
    The timezone on my WP is set to (UTC) London.
    I started noticing this perhaps a week ago. It was working as expected before.
    Phone model is Nokia Lumia 925
    Phone OS version is 8.0.10327.77
    Notes 1-6 suggests to me that the internal calendaring module in WP8 fails to recognize DST (daylight saving time) in timezone (UTC) London or misinterprets relevant information fields on Google calendar objects.
    Note 7 suggests to me that this is related to an update to my WP8 phone or a change in Google calendar API.
    Any help is much appreciated, this is driving me rather nuts.
    Thanks,
    Kaarel

    Further investigation reveals this only happens when the event is created from within WP native calendar app and disappears when I make an edit to the event in any other calendar client including Google web. So a more appropriate description of the problem would be:
    "Native calendar app keeps subtracting 1h off a Google calendar event on EVERY edit"
    Create an event at 2013/07/17 15:00 in WP native calendar app. Result: Event shows as 2013/07/17 15:00 in the calendar app for a few seconds, then updates itself to 2013/07/17 14:00.
    Edit the event title and save in WP native calendar app. Event time moves by -1h again to 2013/07/17 13:00.
    Edit the event title in Google web calendar.
    Subsequent edits in WP native calendar do not mess up the time any longer. If I fix the time to what I originally intended (2013/07/17 15:00) in WP native calendar app, it stays there and shows correctly in all previously mentioned calendar viewers.
    I just learned that Lumia 925 was released with GDR2 update pre-installed. This update is only now being made generally available. If the issue is secific to the CalDAV implementation in GDR2 rather than specific to my phone only, this would make a lot of angry people. I hope I'm wrong on this though as it's an extremely frustrating problem.

  • When a third party program creates a new Google calendar event using a http link I cannot click the save button in Firefox 9.01 or 10b2.

    I use a TV listings program called DigiGuide. This has a script that opens a new Google Calendar event page in my browser for a specified TV program with all fields already completed. I then just have to click the SAVE button on the Google Calendar site to save the event - but since updating to 9.01 from 8.xx this button and others (Discard, Search) has no effect, although the cursor changes when over the button as if it recognised a link. Opening the same page in Chrome works fine. I have also noticed that Calendar's other buttons (e.g. next/previous period) can stop working on the main Calendar page, which I have as a pinned tab - in this event navigating away from Calendar and back again regains that functionality. The issue persists in Firefox 10b2.

    Further investigation reveals this only happens when the event is created from within WP native calendar app and disappears when I make an edit to the event in any other calendar client including Google web. So a more appropriate description of the problem would be:
    "Native calendar app keeps subtracting 1h off a Google calendar event on EVERY edit"
    Create an event at 2013/07/17 15:00 in WP native calendar app. Result: Event shows as 2013/07/17 15:00 in the calendar app for a few seconds, then updates itself to 2013/07/17 14:00.
    Edit the event title and save in WP native calendar app. Event time moves by -1h again to 2013/07/17 13:00.
    Edit the event title in Google web calendar.
    Subsequent edits in WP native calendar do not mess up the time any longer. If I fix the time to what I originally intended (2013/07/17 15:00) in WP native calendar app, it stays there and shows correctly in all previously mentioned calendar viewers.
    I just learned that Lumia 925 was released with GDR2 update pre-installed. This update is only now being made generally available. If the issue is secific to the CalDAV implementation in GDR2 rather than specific to my phone only, this would make a lot of angry people. I hope I'm wrong on this though as it's an extremely frustrating problem.

  • Can't edit Google Calendar events in iCal

    I am using Google Calendar's new CalDAV sync system and their "Calaboration" tool to sync my iCal (version 3.0.5, and I'm using Mac OS 10.5.2) with my Google Calendars, per the instructions on this page:
    http://www.google.com/support/calendar/bin/answer.py?answer=99358#ical
    It seems to work ok in that I can now see my google calendar events in iCal. I can also add an event to that calendar in iCal, and it will sync to my google calendar. However, I can't seem to edit an event in iCal that was created on the Google Calendar web page. That is, all my events that I created in Google Calendar do indeed appear in iCal, but I can't edit them in iCal. I can edit events that I create for that calendar in iCal, but not ones I created in google calendar. Not a huge deal, but I was wondering if this is how it is supposed to work, because it seems a tad inconvenient.
    (I do have my e-mail address in my address book "me" card, so that's not the problem.)

    Yeah, I tried deleting the calendars in iCal and re-synching to them via Calaboration, but the same problem persisted.
    I did find the solution after a bit of experimenting, though. To solve it, I basically created a new calendar on Google Calendar, imported all my events from my old google calendar into it, then used Calaboration to sync iCal to the new Google calendar, and now I can edit events in iCal and GCal without problems. I don't actually know what the problem WAS, but this seems to have solved it. Maybe I made my original Google Calendar too long ago and it had some old bad settings I couldn't see? I dunno, but it doesn't matter now.
    For those who might have this same problem, here's how I transferred my old Google Calendar events into a new Google Calendar without losing anything: (You actually don't need to delete your old Google Calendar at all if you don't want to, so there's no reason to worry about losing your events.)
    1. In GCal, click the "settings" link at the top right of the web page. Then select the "Calendars" tab. Click the "Export My Calendars" link, which should be under your list of calendars, next to the cancel button. This will download a .zip file to your computer, containing all of your google calendars as individual .ics files. Go ahead and unzip them so that the .ics file for the calendar you want to duplicate is sitting in a folder somewhere on your computer.
    2. Now In GCal, click on the "Create" link on the lower righthand side of the "My Calendars" box, which is on the lefthand side of the screen.
    3. Create a new blank calendar and name it whatever you want. This is the blank calendar into which you will import your old calendar's events.
    4. Now, in GCal, click "Add" at the bottom right of the "Other Calendars" box, which is under the "My Calendars" box on the left side of the web page.
    5. Select "Import Calendar".
    6. Click "Choose File" and browse to the .ics file you want to duplicate on your computer.
    7. In the "Choose Calendar" pull-down menu, select the new, blank calendar you made in step 3.
    8. Click Import. This may take a few minutes, depending on the number of events you have in your .ics calendar file.
    9. Once it's done, look at the calendar to make sure your events all came into your new Google Calendar ok. It should look exactly like the original google calendar, but it will be a different color.
    10. NOW, use Calaboration to sync your iCal to the New Calendar you just made in Google Calendar.
    11. Once it's done synching, you should be able to edit events in the calendar in iCal.

  • We got some error while fetching your calendar events.

    We got some error while fetching your calendar events. Please try again. Please try again.
    Suddenly I receive the above message and cannot access my calendar list of events although the calendar itself is displayed. I have closed down several times but the message persists.I am using MAC OSX Snow Leopard/ Firefox 4.01

    I have this same problem. Using XP Home SP3 and Firefox 8.0

  • Bug: Repeating Google Calendar Events Show Up On The Wrong Days

    I've created a Google Calendar event that repeats "Daily," every two days, from 6:00pm to 6:30pm. It shows up fine in my Google Calendar, but the Pre's Calendar puts them on the wrong days. For example, the repeating event that should be scheduled for today shows up tomorrow (offset by +1 day). 
    I tried turning off network timezones, but the bug remains.
    Any help would be greatly appreciated. If this is a bug, how can I submit it to Palm?
    Thanks! 
    Post relates to: Pre p100eww (Sprint)
    Some new data:
    If I create the repeating event on my Pre, rather than via Google, it shows up on the Pre correctly. However, it only shows up for one day via Google (today); the event is not repeated. When I edit the event in Google, it's setup correctly. I tried saving the event from there, but it doesn't cause Google to recognize it should repeat.
    Very frustrating.
    Even more new data:
    Created yet another event via my Pre instead of via Google. This time Google picked up the correct repeat pattern, and my Pre now shows it on the correct days.
    Calendar sync needs serious work, based on my experience. I have issues with Facebook events showing up an hour later than they should, too. Dunno if this has been fixed yet.
    New Data (01/28/2010)
    Not sure why, but the above success reverted back to being off by one day; temporary success only.
    Message Edited by tlpbsd on 01-28-2010 11:52 AM
    This question was solved.
    View Solution.

    Hi, another quick question: you say you turned off network timezones.... did you make sure that the (now manually set) timezone is correct?
    Sounds similar to other issues related to the timezone being off, but usually the appointments were off by hours... not day(s).  However if your timezone is set to something really odd and the event you're creating is around midnight (again depends on a few things here), then MAYBE this is it.
    If it isn't, one of the support guys will have to chat with you privately about possibly collecting logs, getting more granular details, etc.

  • Archive old Google Calendar events from iCal 4?

    I have 8 Google calendars filled with events going back years. It's too big and I want to thin it out by archiving all events older than two years. I'll do it manually, but I can't find a way that works. I haven't found any way within Google to do it and to do it manually from within Google, you have to select each event separately. Too much work.
    To do it for a Mobile Me calendar, I can just:
    - Create a corresponding archive calendar (ie, Archive Personal for my Personal calendar) that is On My Mac
    - Select only one calendar to view (Personal)
    - List all events by typing a period in the search bar
    - Select all events in the list that I want to move
    - Right click or control click one of those selected events in the calendar (not the list) and choose the calendar Archive Personal to move it to
    For the Mobile Me calendar, the events are moved to the Archive Personal calendar and removed from the Mobile Me calendar. Perfect.
    When I try that with a Google calendar, it all seems to work in iCal, but the event remains on the Google calendar. No good.
    I tried another way...
    - I exported one of the calendars from Google into an Archive calendar On My Mac
    - I was planning to delete everything after a certain date on the Archive calendar and delete everything before a certain date on the Google calendar, but when you search for all of the events in the Archive calendar On My Mac, it shows duplicates of every event. Somehow it's showing the Google calendar events as well as the archive calendar events even though the archive is the only calendar selected. The search should only result in events from that calendar!
    Also, searching for a list of all events in a calendar in iCal 4.04 doesn't work too well. Once you move events, the update of the list is spotty. To really see what is left in the calendar, you need to quit iCal and restart it and do the search over again. Hopefully that's fixed in the Lion version!
    If anyone can think of a solution to accomplish this — any better way to archive off old events from a Google calendar, I would appreciate it!

    I just started using MobileMe yesterday and have a similar issue. The only past events in my iPhone are recurring events like birthdays. None of my old one-time events synced to the iPhone. Fortunately, they're all still in iCal (local and online). Does anyone have tips on how to get all events, past, present, and future on the iPhone?

  • Problem while Creating MVLOG with synonym in Oracle 9i:Is it an Oracle Bug?

    Hi All,
    I am facing a problem while Creating MVLOG with synonym in Oracle 9i but for 10G it is working fine. Is it an Oracle Bug? or i am missing something.
    SQL> select * from v$version;
    BANNER
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
    PL/SQL Release 10.2.0.1.0 - Production
    CORE    10.2.0.1.0      Production
    TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    SQL>
    SQL> create table t ( name varchar2(20), id varchar2(1) primary key);
    Table created.
    SQL> create materialized view log on t;
    Materialized view log created.
    SQL> create public synonym syn_t for t;
    Synonym created.
    SQL> CREATE MATERIALIZED VIEW MV_t
      2  REFRESH ON DEMAND
      3  WITH PRIMARY KEY
      4  AS
      5  SELECT name,id
      6  FROM syn_t;
    Materialized view created.
    SQL> CREATE MATERIALIZED VIEW LOG ON  MV_t
      2  WITH PRIMARY KEY
      3   (name)
      4    INCLUDING NEW VALUES;
    Materialized view log created.
    SQL> select * from v$version;
    BANNER
    Oracle9i Enterprise Edition Release 9.2.0.6.0 - Production
    PL/SQL Release 9.2.0.6.0 - Production
    CORE    9.2.0.6.0       Production
    TNS for Solaris: Version 9.2.0.6.0 - Production
    NLSRTL Version 9.2.0.6.0 - Production
    SQL>
    SQL> create table t ( name varchar2(20), id varchar2(1) primary key);
    Table created.
    SQL> create materialized view log on t;
    Materialized view log created.
    SQL> create public synonym syn_t for t;
    Synonym created.
    SQL> CREATE MATERIALIZED VIEW MV_t
    REFRESH ON DEMAND
    WITH PRIMARY KEY
    AS
      2    3    4    5  SELECT name,id
    FROM syn_t;   6
    Materialized view created.
    SQL> CREATE MATERIALIZED VIEW LOG ON  MV_t
    WITH PRIMARY KEY
    (name)
      INCLUDING NEW VALUES;  2    3    4
    CREATE MATERIALIZED VIEW LOG ON  MV_t
    ERROR at line 1:
    ORA-12014: table 'MV_T' does not contain a primary key constraintRegards
    Message was edited by:
    Avinash Tripathi
    null

    Hi Nicloei,
    Thanks for the reply. Actually i don't want any work around (Creating MVLOG on table rather than synonym is fine with me) . I just wanted to know it is actually an oracle bug or something else.
    Regards
    Avinash

  • How do I move google calendar events to iCal?

    how do I move google calendar events to iCal?

    ab1268,
    I'm trying to do this very thing.  I have multiple google calendars set up (one for each kid, my husband etc.).  I want to move to iCal exclusively.  Based on your note above, should I export each individual calendar within ical.  Remove each from the iCal account and then reimport then into ical?  I suppose the risk is low b/c the data still exists in google.
    Please advise - I would hate to misstep.  Very new to the apple world (aside from iphone / ipad).
    Thanks!

  • How to add an attachment to a google calendar event when uisng safari

    how to add an attachment to a google calendar event when uisng safari?

    A similar question/answer here How can I detect end of HTML5 video and do something?
    See if that helps
    Darrell

  • Safari 7.1 update wiped out all my Google Calendar events on mac and iPhone

    After the 7.1 update of Safari, all my events scheduled in google calendar vanished.

    Retract statement about not syncing to iPhone 5, More info: I'm running OS X 10.9.5 and updated to Safari 7.1. All Google Calendar events are gone.

  • Script creates+deletes Google Calendar-events. (free SMS-notification)

    I posted this in another thread too, but since a discussion would be off-topic there (http://bbs.archlinux.org/viewtopic.php?id=64933):
    Here a Python script that creates a Google Calendar-event in the main calendar, with as subject the contents of a specified file.
    Feel free to post modifications/optimizations! I use it this way to get notified of unanswered conversations in finch (as in the thread above), it was easier to work with a file then with specifying arguments..
    PS. The script uses python-mechanize, which is in community.
    #!/usr/bin/python
    # From: gondil
    # To: the Arch Linux forums ;)
    # Version 2 (deletion added)
    import mechanize
    import sys
    import urllib2
    import httplib
    from urllib2 import HTTPError
    # Create a mechanize browser
    mech = mechanize.Browser()
    mech.set_handle_robots(False)
    # With Goggles desired UAgent
    mech.addheaders = [("User-agent", "Java/1.5.0_06")]
    # See the G-API: We need a some token here, that is displayed by /~pkelchte/ (mah personal php site on ESAT that only does that)
    mech.open("https://www.google.com/accounts/AuthSubRequest?scope=http://www.google.com/calendar/feeds/&session=1&secure=0&next=http://homes.esat.kuleuven.be/~pkelchte/index.php")
    # But before we get the token, we need to submit our user-data
    mech.select_form(nr=0)
    mech["Email"] = "" # REPLACE THIS WITH YOUR GOOGLE ACCOUNT
    mech["Passwd"] = "" # AND THIS WITH YOUR PASSWORD
    try:
    mech.submit()
    except:
    print "Did not submit credentials"
    sys.exit("Error in submitting credentials")
    # Because that's not enough, we need to confirm that we want to go trough with this and submit another form...
    mech.select_form(nr=0)
    mech.submit(id='allow')
    # By now, we have one token, but it's not the final token! We need *another* token, called the AuthSubSessionToken, sigh...
    mech.addheaders = [("Authorization", "AuthSub token=\"" + mech.response().read() + "\""), ("User-agent", "Java/1.5.0_06")]
    mech.open("http://www.google.com/accounts/AuthSubSessionToken")
    # A bunch of tokens later...
    # Let's use urllib2 to do this POST request (some xml-y thing is the string you would manually type in the "New event" box on Google Calendar)
    # Encore some headers
    authsub = "AuthSub token=\"" + mech.response().read().replace("\n","").split("=")[1] + "\""
    headers = {"Authorization": authsub, "User-Agent": "Java/1.5.0_06", "Content-Type": "application/atom+xml", "GData-Version": "2"}
    # Read the file that we're interested in! Damn, it's so interesting!!
    file = open('/home/gondil/public_html/fifo', 'r') # CHANGE THIS FILE WITH YOUR THING
    message = file.read()
    file.close()
    # The actual event
    event = """
    <entry xmlns='http://www.w3.org/2005/Atom' xmlns:gCal='http://schemas.google.com/gCal/2005'>
    <content type="html">""" + message + """</content>
    <gCal:quickadd value="true"/>
    </entry>
    req = urllib2.Request("http://www.google.com/calendar/feeds/default/private/full", event, headers)
    calresponse = urllib2.urlopen(req)
    # Normally, we stop here... but since Google likes traffic, we need to go to a slightly different url, with the same headers and POST data
    req2 = urllib2.Request(calresponse.geturl(), event, headers)
    try:
    calresponse2 = urllib2.urlopen(req2)
    # You can check but normally this is a 201 CREATED response or something, I don't really care... It's my code, right :P
    except HTTPError, e :
    # I placed this sleep to give the event at least a 20 second lifetime (poor, poor event...)
    import time
    time.sleep(20)
    # Retrieve the event's edit url
    eventurl = e.read().split("<link rel='edit' type='application/atom+xml' href='http://www.google.com")[1].split("'/>")[0]
    # The Deletion has to be done via httplib, because Google wants a DELETE request (urllib2 only handles GET and POST)
    conn = httplib.HTTPConnection("www.google.com")
    conn.request("DELETE", eventurl, "", headers)
    calresponse3 = conn.getresponse()
    # Again, they like to have a little more traffic, we need to append a session ID to that last url (we can find it in the redirect page)
    eventurl2 = calresponse3.read().split("HREF=\"")[1].split("\"")[0]
    # Ooh and here there is need of a new header, no questions please
    headers2 = {"Authorization": authsub, "User-Agent": "Java/1.5.0_06", "Content-Type": "application/atom+xml", "GData-Version": "2", "If-Match": "*"}
    conn.request("DELETE", eventurl2, "", headers2)
    calresponse4 = conn.getresponse()
    # No errors? Ok we can close the connection
    conn.close()
    index.php looks like this (again I don't guarantee that I'll keep my index.php page like that for eternity, but I'll notify you when the url changes):
    <?php
    print $_POST['token'];
    print $_GET['token'];
    ?>
    Last edited by gondil (2009-04-23 22:45:38)

    I posted this in another thread too, but since a discussion would be off-topic there (http://bbs.archlinux.org/viewtopic.php?id=64933):
    Here a Python script that creates a Google Calendar-event in the main calendar, with as subject the contents of a specified file.
    Feel free to post modifications/optimizations! I use it this way to get notified of unanswered conversations in finch (as in the thread above), it was easier to work with a file then with specifying arguments..
    PS. The script uses python-mechanize, which is in community.
    #!/usr/bin/python
    # From: gondil
    # To: the Arch Linux forums ;)
    # Version 2 (deletion added)
    import mechanize
    import sys
    import urllib2
    import httplib
    from urllib2 import HTTPError
    # Create a mechanize browser
    mech = mechanize.Browser()
    mech.set_handle_robots(False)
    # With Goggles desired UAgent
    mech.addheaders = [("User-agent", "Java/1.5.0_06")]
    # See the G-API: We need a some token here, that is displayed by /~pkelchte/ (mah personal php site on ESAT that only does that)
    mech.open("https://www.google.com/accounts/AuthSubRequest?scope=http://www.google.com/calendar/feeds/&session=1&secure=0&next=http://homes.esat.kuleuven.be/~pkelchte/index.php")
    # But before we get the token, we need to submit our user-data
    mech.select_form(nr=0)
    mech["Email"] = "" # REPLACE THIS WITH YOUR GOOGLE ACCOUNT
    mech["Passwd"] = "" # AND THIS WITH YOUR PASSWORD
    try:
    mech.submit()
    except:
    print "Did not submit credentials"
    sys.exit("Error in submitting credentials")
    # Because that's not enough, we need to confirm that we want to go trough with this and submit another form...
    mech.select_form(nr=0)
    mech.submit(id='allow')
    # By now, we have one token, but it's not the final token! We need *another* token, called the AuthSubSessionToken, sigh...
    mech.addheaders = [("Authorization", "AuthSub token=\"" + mech.response().read() + "\""), ("User-agent", "Java/1.5.0_06")]
    mech.open("http://www.google.com/accounts/AuthSubSessionToken")
    # A bunch of tokens later...
    # Let's use urllib2 to do this POST request (some xml-y thing is the string you would manually type in the "New event" box on Google Calendar)
    # Encore some headers
    authsub = "AuthSub token=\"" + mech.response().read().replace("\n","").split("=")[1] + "\""
    headers = {"Authorization": authsub, "User-Agent": "Java/1.5.0_06", "Content-Type": "application/atom+xml", "GData-Version": "2"}
    # Read the file that we're interested in! Damn, it's so interesting!!
    file = open('/home/gondil/public_html/fifo', 'r') # CHANGE THIS FILE WITH YOUR THING
    message = file.read()
    file.close()
    # The actual event
    event = """
    <entry xmlns='http://www.w3.org/2005/Atom' xmlns:gCal='http://schemas.google.com/gCal/2005'>
    <content type="html">""" + message + """</content>
    <gCal:quickadd value="true"/>
    </entry>
    req = urllib2.Request("http://www.google.com/calendar/feeds/default/private/full", event, headers)
    calresponse = urllib2.urlopen(req)
    # Normally, we stop here... but since Google likes traffic, we need to go to a slightly different url, with the same headers and POST data
    req2 = urllib2.Request(calresponse.geturl(), event, headers)
    try:
    calresponse2 = urllib2.urlopen(req2)
    # You can check but normally this is a 201 CREATED response or something, I don't really care... It's my code, right :P
    except HTTPError, e :
    # I placed this sleep to give the event at least a 20 second lifetime (poor, poor event...)
    import time
    time.sleep(20)
    # Retrieve the event's edit url
    eventurl = e.read().split("<link rel='edit' type='application/atom+xml' href='http://www.google.com")[1].split("'/>")[0]
    # The Deletion has to be done via httplib, because Google wants a DELETE request (urllib2 only handles GET and POST)
    conn = httplib.HTTPConnection("www.google.com")
    conn.request("DELETE", eventurl, "", headers)
    calresponse3 = conn.getresponse()
    # Again, they like to have a little more traffic, we need to append a session ID to that last url (we can find it in the redirect page)
    eventurl2 = calresponse3.read().split("HREF=\"")[1].split("\"")[0]
    # Ooh and here there is need of a new header, no questions please
    headers2 = {"Authorization": authsub, "User-Agent": "Java/1.5.0_06", "Content-Type": "application/atom+xml", "GData-Version": "2", "If-Match": "*"}
    conn.request("DELETE", eventurl2, "", headers2)
    calresponse4 = conn.getresponse()
    # No errors? Ok we can close the connection
    conn.close()
    index.php looks like this (again I don't guarantee that I'll keep my index.php page like that for eternity, but I'll notify you when the url changes):
    <?php
    print $_POST['token'];
    print $_GET['token'];
    ?>
    Last edited by gondil (2009-04-23 22:45:38)

  • Google calendar events disappear

    I have been synching all of my Apple devices (iMac, MacBook, iPad, iPod Touch) using Mobil Me. I use gmail and Google calendar for all my events. Never had a problem until today. Every time I add an event to my Google calendar in iCal, the event disappears when iCal refreshes on my iMac. Other devices retain all the events. I have set up Google Calendar in iCal using CalDAV following the instructions and it has worked in the past. What's happening?

    I was having mysterious issues with my iPhone iCal today. I too use gmail calendars as my hub because it is central to my work place. I have used CDAV in the past with no issues. So what I just did successfully was to delete my gmail account from the iPhone accounts preference, made sure that my MobileMe calendar was OFF, and reaccessed only the gmail account with the calendar only setting (as my work gmail is accessed by a separate account). This worked fine. In a few minutes all of my CDAV calendars loaded correctly and I'm back in business.

  • Problem Synching with Google Calendar

    Having difficulty syching 8900 with Google calendar. Downloaded google synch to phone. When I check the Calendar Properties it show Wireless Synchroniztion as "No". It won't let me change this.. When I try to synch. I get the message that says"Login failed, due to network problems, please check your settings" Service is with Tmobile. Not sure which settings are not right.

    The calendar options should say no. It will only say "yes" is if you're on a BES. I think I had that error when I first started using Google Sync a while ago. I think I just uninstalled and reinstalled the program after getting that error a few times and then I was able to log in and setup the program
    If someone has been helpful please consider giving them kudos by clicking the star to the left of their post.
    Remember to resolve your thread by clicking Accepted Solution.

  • Problems syncing new google calendar delegates to iPhone 3

    I got a iPhone 3 a few months ago and had no problem setting up calendar so that all of my google calendar delegates are visible in both iCal and on my iPhone. I haven't had any problems with getting events to update on all of my calendars regardless of which program I use to create/ edit the event, until now. I recently created a new google calendar delegate. I can access the delegate in both iCal and on google but for some reason I can't get the new delegate to sync to my iPhone. I've tried to edit the settings in all of the programs, i've edited events on the new calendar on google on my iPhone, on my computer and on iCal but I still can't get it to show up in calendar on my iPhone. Any suggestions on fixing this problem?

    I didn't know it was possible. How do I find an option to subscribe to a new calendar from within the iPhone? I've always subscribed via synching.

Maybe you are looking for