Python 3 Example: Searching for NMR Entries

import requests

if __name__ == '__main__':
    url = 'http://www.rcsb.org/pdb/rest/search'

    query_text = """
<?xml version="1.0" encoding="UTF-8"?>

<orgPdbQuery>

<version>B0907</version>

<queryType>org.pdb.query.simple.ExpTypeQuery</queryType>

<description>Experimental Method Search: Experimental Method=SOLID-STATE NMR</description>

<mvStructure.expMethod.value>SOLID-STATE NMR</mvStructure.expMethod.value>

</orgPdbQuery>

"""

    print("Query: %s" % query_text)
    print("Querying RCSB PDB REST API...")

    header = {'Content-Type': 'application/x-www-form-urlencoded'}

    response = requests.post(url, data=query_text, headers=header)

    if response.status_code == 200:
        print("Found %d PDB entries matching query." % len(response.text))
        print("Matches: \n%s" % response.text)
    else:
        print("Failed to retrieve results")

Provided by Carlos Oliver