Guest User

Untitled

a guest
Jul 26th, 2018
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.68 KB | None | 0 0
  1. <?xml version="1.0" encoding="utf-8" standalone="yes"?>
  2. <feed xml:base="https://share.corp.com/sites/CPIBudget/_vti_bin/ListData.svc/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">
  3. <title type="text">Tbl_Projects_Tableau</title>
  4. <id>https://share.corp.com/sites/CPIBudget/_vti_bin/ListData.svc/Tbl_Projects_Tableau/</id>
  5. <updated>2018-07-25T21:27:59Z</updated>
  6. <link rel="self" title="Tbl_Projects_Tableau" href="Tbl_Projects_Tableau" />
  7. <entry m:etag="W/"8"">
  8. <id>https://share.corp.com/sites/CPIBudget/_vti_bin/ListData.svc/Tbl_Projects_Tableau(1)</id>
  9. <title type="text"></title>
  10. <updated>2018-06-14T17:15:27Z</updated>
  11. <author>
  12. <name />
  13. </author>
  14. <link rel="edit" title="Tbl_Projects_TableauItem" href="Tbl_Projects_Tableau(1)" />
  15. <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/FBN_ID" type="application/atom+xml;type=entry" title="FBN_ID" href="Tbl_Projects_Tableau(1)/FBN_ID" />
  16. <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/CreatedBy" type="application/atom+xml;type=entry" title="CreatedBy" href="Tbl_Projects_Tableau(1)/CreatedBy" />
  17. <link rel="http://schemas.microsoft.com/ado/2007/08/dataservices/related/ModifiedBy" type="application/atom+xml;type=entry" title="ModifiedBy" href="Tbl_Projects_Tableau(1)/ModifiedBy" />
  18. <category term="Microsoft.SharePoint.DataService.Tbl_Projects_TableauItem" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
  19. <content type="application/xml">
  20. <m:properties>
  21. <d:FBN_IDId m:type="Edm.Int32">6</d:FBN_IDId>
  22. <d:Title m:null="true" />
  23. <d:PROJECT_NAME>Project Swoop</d:PROJECT_NAME>
  24. <d:Cluster>ABC</d:Cluster>
  25. <d:PROJECT_SITE>ABC9</d:PROJECT_SITE>
  26. <d:PROJECT_ORIGINALAMT m:type="Edm.Double">500000</d:PROJECT_ORIGINALAMT>
  27. <d:PROJECT_ORG>Nookie</d:PROJECT_ORG>
  28. <d:PROJECT_GROUP>Smooth</d:PROJECT_GROUP>
  29. <d:c__OldID m:type="Edm.Double">1</d:c__OldID>
  30. <d:ContentTypeID>0x0100FD279BEBCF3C4F45BB75D6147D315C09</d:ContentTypeID>
  31. <d:Id m:type="Edm.Int32">1</d:Id>
  32. <d:ContentType>Item</d:ContentType>
  33. <d:Modified m:type="Edm.DateTime">2018-06-14T17:15:27</d:Modified>
  34. <d:Created m:type="Edm.DateTime">2018-06-14T16:58:50</d:Created>
  35. <d:CreatedById m:type="Edm.Int32">2</d:CreatedById>
  36. <d:ModifiedById m:type="Edm.Int32">2</d:ModifiedById>
  37. <d:Owshiddenversion m:type="Edm.Int32">8</d:Owshiddenversion>
  38. <d:Version>1.0</d:Version>
  39. <d:Path>/sites/SmoothBudget/Lists/Projects_Tableau1</d:Path>
  40. </m:properties>
  41. </content>
  42. </entry>
  43. </feed>
  44.  
  45. import config
  46. import csv
  47. import pymysql
  48. import requests
  49. import xml.etree.ElementTree as ET
  50. from requests_ntlm import HttpNtlmAuth
  51.  
  52. ssoUsername = config.username
  53. ssoPassword = config.password
  54.  
  55. f = open(path+csvFile,'w',newline='')
  56. csvwriter = csv.writer(f)
  57. column_headers = ['FBN','Project_Name','Cluster','Site','OP2_USD','Type','Group']
  58. csvwriter.writerow(column_headers)
  59.  
  60. rows = []
  61. r2 = requests.get(project_url, auth=HttpNtlmAuth('ANT\'+ssoUsername,ssoPassword), verify=False)
  62. projectData = r2.content
  63. etree2 = ET.fromstring(projectData)
  64.  
  65. #print(etree2.findall('.****'))
  66.  
  67. for element in etree2.findall(".****") :
  68. print(element.find('{http://schemas.microsoft.com/ado/2007/08/dataservices}FBN_IDId'))
  69. fbnKey2 = element.find('{http://schemas.microsoft.com/ado/2007/08/dataservices}FBN_IDId')
  70. FBN = fbnMap.get(fbnKey2)
  71.  
  72. [<Element '{http://schemas.microsoft.com/ado/2007/08/dataservices}ContentTypeID' at 0x000001C4B7F31BD8>, <Element '{http://schemas.microsoft.com/ado/2007/08/dataservices}Id' at 0x000001C4B7F31C28>, <Element '{http://schemas.microsoft.com/ado/2007/08/dataservices}ContentType' at 0x000001C4B7F31C78>, <Element '{http://schemas.microsoft.com/ado/2007/08/dataservices}Modified' at 0x000001C4B7F31CC8>, <Element '{http://schemas.microsoft.com/ado/2007/08/dataservices}Created' at 0x000001C4B7F31D18>, <Element '{http://schemas.microsoft.com/ado/2007/08/dataservices}CreatedById' at 0x000001C4B7F31D68>, <Element '{http://schemas.microsoft.com/ado/2007/08/dataservices}ModifiedById' at 0x000001C4B7F31DB8>, <Element '{http://schemas.microsoft.com/ado/2007/08/dataservices}Owshiddenversion' at 0x000001C4B7F31E08>, <Element '{http://schemas.microsoft.com/ado/2007/08/dataservices}Version' at 0x000001C4B7F31E58>, <Element '{http://schemas.microsoft.com/ado/2007/08/dataservices}Path' at 0x000001C4B7F31EA8>, <Element '{http://schemas.microsoft.com/ado/2007/08/dataservices}FBN_IDId' at 0x000001C4B7F3ABD8>, <Element '{http://schemas.microsoft.com/ado/2007/08/dataservices}Title' at 0x000001C4B7F3AB88>, <Element '{http://schemas.microsoft.com/ado/2007/08/dataservices}PROJECT_NAME' at 0x000001C4B7F3AB38>, <Element '{http://schemas.microsoft.com/ado/2007/08/dataservices}Cluster' at 0x000001C4B7F3AA98>, <Element '{http://schemas.microsoft.com/ado/2007/08/dataservices}PROJECT_SITE' at 0x000001C4B7F3AA48>, <Element '{http://schemas.microsoft.com/ado/2007/08/dataservices}PROJECT_ORIGINALAMT' at 0x000001C4B7F3A9F8>, <Element '{http://schemas.microsoft.com/ado/2007/08/dataservices}PROJECT_ORG' at 0x000001C4B7F3A908>, <Element '{http://schemas.microsoft.com/ado/2007/08/dataservices}PROJECT_GROUP' at 0x000001C4B7F3A868>, <Element '{http://schemas.microsoft.com/ado/2007/08/dataservices}c__OldID' at 0x000001C4B7F3A8B8>, <Element '{http://schemas.microsoft.com/ado/2007/08/dataservices}ContentTypeID' at 0x000001C4B7F3A778>, <Element '{http://schemas.microsoft.com/ado/2007/08/dataservices}Id' at 0x000001C4B7F3A728>, <Element '{http://schemas.microsoft.com/ado/2007/08/dataservices}ContentType' at 0x000001C4B7F3A6D8>, <Element '{http://schemas.microsoft.com/ado/2007/08/dataservices}Modified' at 0x000001C4B7F3A138>, <Element '{http://schemas.microsoft.com/ado/2007/08/dataservices}Created' at 0x000001C4B7F3A048>, <Element '{http://schemas.microsoft.com/ado/2007/08/dataservices}CreatedById' at 0x000001C4B7F3A638>, <Element '{http://schemas.microsoft.com/ado/2007/08/dataservices}ModifiedById' at 0x000001C4B7F3A5E8>, <Element '{http://schemas.microsoft.com/ado/2007/08/dataservices}Owshiddenversion' at 0x000001C4B7F3A548>, <Element '{http://schemas.microsoft.com/ado/2007/08/dataservices}Version' at 0x000001C4B7F3A598>, <Element '{http://schemas.microsoft.com/ado/2007/08/dataservices}Path' at 0x000001C4B7F3A4F8>]
  73.  
  74. None
  75. <Element '{http://schemas.microsoft.com/ado/2007/08/dataservices}FBN_IDId' at 0x000001C4B7F3ABD8>
  76.  
  77. for element in etree2.findall(".//{http://schemas.microsoft.com/ado/2007/08/dataservices}FBN_IDId") :
  78. fbnKey2 = element.text
  79. FBN = fbnMap.get(fbnKey2)
Add Comment
Please, Sign In to add comment