title: Parsing vcf file in django-python using vobject
body: <p>I am using vobject module to parse a vcard which I have exported from MS outlook.
  It has content as below:</p>
  
  <pre><code>BEGIN:VCARD
  VERSION:2.1
  N:Salei;Roya
  FN:Roya Salei
  ORG:MealPlanBook
  TEL;WORK;VOICE:(3) 228-7373
  TEL;HOME;VOICE:2343243423
  TEL;CELL;VOICE:3243443234
  TEL;PREF:310-889-8166
  ADR;WORK;PREF:;;street abc;new york;new york;928293;United States of America
  LABEL;WORK;PREF;ENCODING=QUOTED-PRINTABLE:street abc=0D=0A=
  new york, new york  928293
  X-MS-OL-DEFAULT-POSTAL-ADDRESS:2
  URL;WORK:www.roya.com
  EMAIL;PREF;INTERNET:roya@gmail.com
  X-MS-CARDPICTURE;TYPE=JPEG;ENCODING=BASE64:
   /9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAcFBQYFBAcGBQYIBwcIChELCgkJChUPEAwRGBUa
   GRgVGBcbHichGx0lHRcYIi4iJSgpKywrGiAvMy8qMicqKyr/2wBDAQcICAoJChQLCxQqHBgc
   KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKir/wAAR
   CACUACcDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAA
   AgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkK
   FhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWG
   h4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl
   5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREA
   AgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYk
   NOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOE
   hYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk
   5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD393C4B6mgHqSeKhc7nOPoKRj2HQUAPef+
   5z7mlj5GT19agAyasD5U59M0AQyfPNj0opIhliaKAHDjJ9BSUp+7SUAEYy1SzHEZ9+KbCOaS
   Y8gUANU7Yie+aKJOFVaKAFbrxSUdqB1oAnjHy5qA/NN+NWD8kf0FV4uWJ9qAElOXxRTWbJJ9
   6KAH9qdGPmFN7VLEP5YoAJmwgHrUa/LGT60sxy+PQUEEqFXk96AIKKmEar9880UAA5OKlQ4X
   jknmkDIei8/SlclUOOKAG+WN2X5J7CmvIRwo28UkfLEnrimuQXNADVG5vmNFJjJwKKALEY+Y
   fnSzHoPxpY1+U/lTHZdx4yenPQUAEYIXPvUeFXqcn0FSOf3fPHAHFRUABc9F+X6UUyigC8eE
   57VXA3MPc1PKcRn3qFOpPoKACQ9PxNR06T72PTim0AMooooAszH5gPSkj+7z3NI5yx+tOPCf
   QfzoAhJyc0UHrRQAyiiigCyH3EAilYrjnuaYnUn0FI/UD0FABsU9P0NIY/f8xTT1oDEdCRQA
   bG7c/Q0Ubz3AP4UUASp91vwprffb60UUAMPWiiigBlFFFAH/2Q==
  
  X-MS-OL-DESIGN;CHARSET=utf-8:&lt;card xmlns="http://schemas.microsoft.com/office/outlook/12/electronicbusinesscards" ver="1.0" layout="left" bgcolor="ffffff"&gt;&lt;img xmlns="" align="fit" area="16" use="cardpicture"/&gt;&lt;fld xmlns="" prop="name" align="left" dir="ltr" style="b" color="000000" size="10"/&gt;&lt;fld xmlns="" prop="org" align="left" dir="ltr" color="000000" size="8"/&gt;&lt;fld xmlns="" prop="telwork" align="left" dir="ltr" color="000000" size="8"&gt;&lt;label align="right" color="626262"&gt;Work&lt;/label&gt;&lt;/fld&gt;&lt;fld xmlns="" prop="telpri" align="left" dir="ltr" color="000000" size="8"&gt;&lt;label align="right" color="626262"&gt;Primary&lt;/label&gt;&lt;/fld&gt;&lt;fld xmlns="" prop="telcell" align="left" dir="ltr" color="000000" size="8"&gt;&lt;label align="right" color="626262"&gt;Mobile&lt;/label&gt;&lt;/fld&gt;&lt;fld xmlns="" prop="telhome" align="left" dir="ltr" color="000000" size="8"&gt;&lt;label align="right" color="626262"&gt;Home&lt;/label&gt;&lt;/fld&gt;&lt;fld xmlns="" prop="email" align="left" dir="ltr" color="000000" size="8"/&gt;&lt;fld xmlns="" prop="addrwork" align="left" dir="ltr" color="000000" size="8"/&gt;&lt;fld xmlns="" prop="webwork" align="left" dir="ltr" color="000000" size="8"/&gt;&lt;fld xmlns="" prop="blank" size="8"/&gt;&lt;fld xmlns="" prop="blank" size="8"/&gt;&lt;fld xmlns="" prop="blank" size="8"/&gt;&lt;fld xmlns="" prop="blank" size="8"/&gt;&lt;fld xmlns="" prop="blank" size="8"/&gt;&lt;fld xmlns="" prop="blank" size="8"/&gt;&lt;fld xmlns="" prop="blank" size="8"/&gt;&lt;/card&gt;
  REV:20160723T142140Z
  END:VCARD
  </code></pre>
  
  <p>while parsing I got below error:</p>
  
  <blockquote>
    <p>ParseError at /importcontactsfromvcard/</p>
    
    <p>At line 12: Failed to parse line: new york, new york  928293</p>
  </blockquote>
  
  <p>I am using below Code:</p>
  
  <pre><code>in_data = request.body
  vcard = vobject.readOne(in_data)
  contents = vcard.contents
  </code></pre>
  
  <p>They worked perfectly fine when I omit some content from file and It looks as below:</p>
  
  <pre><code>BEGIN:VCARD
  VERSION:2.1
  N:Salei;Roya
  FN:Roya Salei
  ORG:MealPlanBook
  TEL;WORK;VOICE:(3) 228-7373
  TEL;HOME;VOICE:2343243423
  TEL;CELL;VOICE:3243443234
  TEL;PREF:310-889-8166
  ADR;WORK;PREF:;;street abc;new york;new york;928293;United States of America
  END:VCARD
  </code></pre>
  
  <p>I am new in python and working on vcards for first time. I don't know how can I ignore above error to parse Vcard.</p>