Skip to content

Instantly share code, notes, and snippets.

@venkyvb
Created November 1, 2015 02:21
Show Gist options
  • Save venkyvb/e3b1084349604e2547df to your computer and use it in GitHub Desktop.
Save venkyvb/e3b1084349604e2547df to your computer and use it in GitHub Desktop.
Python OData Read Metadata
import urllib2, base64
username = "user_name_here"
password = "password_here"
request = urllib2.Request("https://myNNNNNN.crm.ondemand.com/sap/c4c/odata/v1/c4codata/$metadata")
base64string = base64.encodestring('%s:%s' % (username, password)).replace('\n', '')
request.add_header("Authorization", "Basic %s" % base64string)
result = urllib2.urlopen(request)
content = result.read()
print(content)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment