Created
September 10, 2015 03:47
-
-
Save dkav6/bbd1235012a6f2d75e63 to your computer and use it in GitHub Desktop.
python requests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
payload = {'Controller': 'Contact'} | |
r = requests.get('https://apps.net-results.com/api/v2/rpc/server.php', | |
# auth hidden after output | |
auth=('hidden', 'hidden'), params=payload) | |
r.status_code | |
print(r.url) | |
# output https://apps.net-results.com/api/v2/rpc/server.php?Controller=Contact | |
r.headers | |
# output | |
# {'connection': 'keep-alive', 'server': 'nginx/1.4.6 (Ubuntu)', 'cache-control': 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0', 'set-cookie': 'PHPSESSID=aq9th4kpescmojqprj1ql3sjj6; path=/', 'expires': 'Thu, 19 Nov 1981 08:52:00 GMT', 'content-type': 'application/json; charset=utf-8', 'transfer-encoding': 'chunked', 'access-control-allow-origin': '*', 'x-powered-by': 'PHP/5.5.9-1ubuntu4.11', 'content-encoding': 'gzip', 'date': 'Thu, 10 Sep 2015 03:42:26 GMT', 'pragma': 'no-cache'} | |
data = r.json() | |
print(data) | |
# output | |
# {'SMDVersion': '2.0', | |
# 'contentType': 'application/json; charset=utf-8', | |
# 'envelope': 'JSON-RPC-2.0', | |
# 'methods': {'getByLeadStatus': {'envelope': 'JSON-RPC-2.0', | |
# 'help': 'Returns Contacts with the specified Lead Status ID.', | |
# 'parameters': [{'name': 'lead_status_id', | |
# 'optional': False, | |
# 'type': 'integer'}, | |
# {'name': 'limit', 'optional': False, 'type': 'integer'}, | |
# {'name': 'offset', 'optional': False, 'type': 'integer'}], | |
# 'returns': 'object', | |
# 'transport': 'POST'}, | |
# 'getContactIdByEmailAddress': {'envelope': 'JSON-RPC-2.0', | |
# 'help': 'Returns the contact id that belongs to the given email address. Parameter email_address must validate as an email address.', | |
# 'parameters': [{'name': 'email_address', | |
# 'optional': False, | |
# 'type': 'string'}], | |
# 'returns': 'object', | |
# 'transport': 'POST'}, | |
# 'getContactIdByMauuid': {'envelope': 'JSON-RPC-2.0', | |
# 'help': 'Returns contact id that belongs to the given mauuid (Which is placed in a first party cookie on your domains. The mauuid will vary across domains, but may still represent one Contact. Contact support for more information.). Parameter mauuid must validate as a uuid and must have been tracked at least once on your account..', | |
# 'parameters': [{'name': 'mauuid', 'optional': False, 'type': 'string'}], | |
# 'returns': 'object', | |
# 'transport': 'POST'}, | |
# 'getMailableStatistics': {'envelope': 'JSON-RPC-2.0', | |
# 'help': 'Returns mailing statistics for each date of the passed date range, as well as a total for the start of the range.', | |
# 'parameters': [{'name': 'start_date', 'optional': False, 'type': 'integer'}, | |
# {'name': 'stop_date', 'optional': False, 'type': 'integer'}], | |
# 'returns': 'object', | |
# 'transport': 'POST'}, | |
# 'getMailingInfo': {'envelope': 'JSON-RPC-2.0', | |
# 'help': 'Returns Subscriptions that the Contact is participating in.', | |
# 'parameters': [{'name': 'contact_id', | |
# 'optional': False, | |
# 'type': 'integer'}], | |
# 'returns': 'object', | |
# 'transport': 'POST'}, | |
# 'getMineLeadScores': {'envelope': 'JSON-RPC-2.0', | |
# 'help': 'Returns Contact PII (Id, Name, Email, Company, Contact Score, Work Phone) for all Contacts whom have a Contact Owner of the logged in user.', | |
# 'parameters': [{'name': 'offset', 'optional': False, 'type': 'integer'}, | |
# {'name': 'limit', 'optional': False, 'type': 'integer'}, | |
# {'name': 'order_by', 'optional': False, 'type': 'string'}, | |
# {'name': 'order_dir', 'optional': False, 'type': 'string'}, | |
# {'name': 'overlay_id', 'optional': False, 'type': 'string'}, | |
# {'default': [], 'name': 'filters', 'optional': True, 'type': 'array'}], | |
# 'returns': 'object', | |
# 'transport': 'POST'}, | |
# 'getMultiple': {'envelope': 'JSON-RPC-2.0', | |
# 'help': 'Returns all Contacts', | |
# 'parameters': [{'name': 'offset', 'optional': False, 'type': 'integer'}, | |
# {'name': 'limit', 'optional': False, 'type': 'integer'}, | |
# {'name': 'order_by', 'optional': False, 'type': 'string'}, | |
# {'name': 'order_dir', 'optional': False, 'type': 'string'}, | |
# {'default': [], 'name': 'options', 'optional': True, 'type': 'array'}], | |
# 'returns': 'object', | |
# 'transport': 'POST'}, | |
# 'getMultipleBySegmentId': {'envelope': 'JSON-RPC-2.0', | |
# 'help': 'Returns Contact PII (Id, Name, Email, Company, Contact Score, Work Phone) for all Contacts qualifying for segment_id', | |
# 'parameters': [{'name': 'offset', 'optional': False, 'type': 'integer'}, | |
# {'name': 'limit', 'optional': False, 'type': 'integer'}, | |
# {'name': 'order_by', 'optional': False, 'type': 'string'}, | |
# {'name': 'order_dir', 'optional': False, 'type': 'string'}, | |
# {'name': 'start_date', 'optional': False, 'type': 'string'}, | |
# {'name': 'stop_date', 'optional': False, 'type': 'string'}, | |
# {'name': 'contact_segment_id', 'optional': False, 'type': 'string'}, | |
# {'name': 'overlay_id', 'optional': False, 'type': 'string'}, | |
# {'default': [], 'name': 'filters', 'optional': True, 'type': 'array'}], | |
# 'returns': 'object', | |
# 'transport': 'POST'}, | |
# 'getOne': {'envelope': 'JSON-RPC-2.0', | |
# 'help': 'Returns a Contact', | |
# 'parameters': [{'name': 'contact_id', | |
# 'optional': False, | |
# 'type': 'integer'}], | |
# 'returns': 'object', | |
# 'transport': 'POST'}, | |
# 'getOneWithScore': {'envelope': 'JSON-RPC-2.0', | |
# 'help': 'Returns a Contact with an overlay score.', | |
# 'parameters': [{'name': 'contact_id', 'optional': False, 'type': 'integer'}, | |
# {'name': 'overlay_id', 'optional': False, 'type': 'integer'}], | |
# 'returns': 'object', | |
# 'transport': 'POST'}, | |
# 'submitContactImport': {'envelope': 'JSON-RPC-2.0', | |
# 'help': 'Submits a Contact import.<br/>\nAvailable attributes include:<br/>\n<ul>\n <li>Email Address (Must be a valid address)</li>\n <li>First Name</li>\n <li>Last Name</li>\n <li>Title</li>\n <li>Company Name</li>\n <li>Address 1</li>\n <li>Address 2</li>\n <li>City</li>\n <li>State</li>\n <li>Zip</li>\n <li>Country</li>\n <li>Home Phone</li>\n <li>Work Phone</li>\n <li>Mobile Phone</li>\n <li>Fax</li>\n <li>Unique Contact ID (Must be a number issued by the platform. Any ID not issued by the platform will be skipped)</li>\n <li>Unsubscribed Contact</li>\n <li>Bounced Contact</li>\n <li>Lead Owner Email Address</li>\n</ul>\n# You may also specify any active Custom Field', | |
# 'parameters': [{'name': 'contacts', 'optional': False, 'type': 'array'}, | |
# {'name': 'overwrite', 'optional': False, 'type': 'boolean'}, | |
# {'name': 'contact_import_mapping', 'optional': False, 'type': 'array'}, | |
# {'name': 'contact_import_name', 'optional': False, 'type': 'string'}, | |
# {'name': 'notification_recipients', 'optional': False, 'type': 'array'}, | |
# {'name': 'add_to_lists', 'optional': False, 'type': 'array'}, | |
# {'name': 'remove_from_lists', 'optional': False, 'type': 'array'}], | |
# 'returns': 'integer', | |
# 'transport': 'POST'}}, | |
# 'services': {'getByLeadStatus': {'envelope': 'JSON-RPC-2.0', | |
# 'help': 'Returns Contacts with the specified Lead Status ID.', | |
# 'parameters': [{'name': 'lead_status_id', | |
# 'optional': False, | |
# 'type': 'integer'}, | |
# {'name': 'limit', 'optional': False, 'type': 'integer'}, | |
# {'name': 'offset', 'optional': False, 'type': 'integer'}], | |
# 'returns': 'object', | |
# 'transport': 'POST'}, | |
# 'getContactIdByEmailAddress': {'envelope': 'JSON-RPC-2.0', | |
# 'help': 'Returns the contact id that belongs to the given email address. Parameter email_address must validate as an email address.', | |
# 'parameters': [{'name': 'email_address', | |
# 'optional': False, | |
# 'type': 'string'}], | |
# 'returns': 'object', | |
# 'transport': 'POST'}, | |
# 'getContactIdByMauuid': {'envelope': 'JSON-RPC-2.0', | |
# 'help': 'Returns contact id that belongs to the given mauuid (Which is placed in a first party cookie on your domains. The mauuid will vary across domains, but may still represent one Contact. Contact support for more information.). Parameter mauuid must validate as a uuid and must have been tracked at least once on your account..', | |
# 'parameters': [{'name': 'mauuid', 'optional': False, 'type': 'string'}], | |
# 'returns': 'object', | |
# 'transport': 'POST'}, | |
# 'getMailableStatistics': {'envelope': 'JSON-RPC-2.0', | |
# 'help': 'Returns mailing statistics for each date of the passed date range, as well as a total for the start of the range.', | |
# 'parameters': [{'name': 'start_date', 'optional': False, 'type': 'integer'}, | |
# {'name': 'stop_date', 'optional': False, 'type': 'integer'}], | |
# 'returns': 'object', | |
# 'transport': 'POST'}, | |
# 'getMailingInfo': {'envelope': 'JSON-RPC-2.0', | |
# 'help': 'Returns Subscriptions that the Contact is participating in.', | |
# 'parameters': [{'name': 'contact_id', | |
# 'optional': False, | |
# 'type': 'integer'}], | |
# 'returns': 'object', | |
# 'transport': 'POST'}, | |
# 'getMineLeadScores': {'envelope': 'JSON-RPC-2.0', | |
# 'help': 'Returns Contact PII (Id, Name, Email, Company, Contact Score, Work Phone) for all Contacts whom have a Contact Owner of the logged in user.', | |
# 'parameters': [{'name': 'offset', 'optional': False, 'type': 'integer'}, | |
# {'name': 'limit', 'optional': False, 'type': 'integer'}, | |
# {'name': 'order_by', 'optional': False, 'type': 'string'}, | |
# {'name': 'order_dir', 'optional': False, 'type': 'string'}, | |
# {'name': 'overlay_id', 'optional': False, 'type': 'string'}, | |
# {'default': [], 'name': 'filters', 'optional': True, 'type': 'array'}], | |
# 'returns': 'object', | |
# 'transport': 'POST'}, | |
# 'getMultiple': {'envelope': 'JSON-RPC-2.0', | |
# 'help': 'Returns all Contacts', | |
# 'parameters': [{'name': 'offset', 'optional': False, 'type': 'integer'}, | |
# {'name': 'limit', 'optional': False, 'type': 'integer'}, | |
# {'name': 'order_by', 'optional': False, 'type': 'string'}, | |
# {'name': 'order_dir', 'optional': False, 'type': 'string'}, | |
# {'default': [], 'name': 'options', 'optional': True, 'type': 'array'}], | |
# 'returns': 'object', | |
# 'transport': 'POST'}, | |
# 'getMultipleBySegmentId': {'envelope': 'JSON-RPC-2.0', | |
# 'help': 'Returns Contact PII (Id, Name, Email, Company, Contact Score, Work Phone) for all Contacts qualifying for segment_id', | |
# 'parameters': [{'name': 'offset', 'optional': False, 'type': 'integer'}, | |
# {'name': 'limit', 'optional': False, 'type': 'integer'}, | |
# {'name': 'order_by', 'optional': False, 'type': 'string'}, | |
# {'name': 'order_dir', 'optional': False, 'type': 'string'}, | |
# {'name': 'start_date', 'optional': False, 'type': 'string'}, | |
# {'name': 'stop_date', 'optional': False, 'type': 'string'}, | |
# {'name': 'contact_segment_id', 'optional': False, 'type': 'string'}, | |
# {'name': 'overlay_id', 'optional': False, 'type': 'string'}, | |
# {'default': [], 'name': 'filters', 'optional': True, 'type': 'array'}], | |
# 'returns': 'object', | |
# 'transport': 'POST'}, | |
# 'getOne': {'envelope': 'JSON-RPC-2.0', | |
# 'help': 'Returns a Contact', | |
# 'parameters': [{'name': 'contact_id', | |
# 'optional': False, | |
# 'type': 'integer'}], | |
# 'returns': 'object', | |
# 'transport': 'POST'}, | |
# 'getOneWithScore': {'envelope': 'JSON-RPC-2.0', | |
# 'help': 'Returns a Contact with an overlay score.', | |
# 'parameters': [{'name': 'contact_id', 'optional': False, 'type': 'integer'}, | |
# {'name': 'overlay_id', 'optional': False, 'type': 'integer'}], | |
# 'returns': 'object', | |
# 'transport': 'POST'}, | |
# 'submitContactImport': {'envelope': 'JSON-RPC-2.0', | |
# 'help': 'Submits a Contact import.<br/>\nAvailable attributes include:<br/>\n<ul>\n <li>Email Address (Must be a valid address)</li>\n <li>First Name</li>\n <li>Last Name</li>\n <li>Title</li>\n <li>Company Name</li>\n <li>Address 1</li>\n <li>Address 2</li>\n <li>City</li>\n <li>State</li>\n <li>Zip</li>\n <li>Country</li>\n <li>Home Phone</li>\n <li>Work Phone</li>\n <li>Mobile Phone</li>\n <li>Fax</li>\n <li>Unique Contact ID (Must be a number issued by the platform. Any ID not issued by the platform will be skipped)</li>\n <li>Unsubscribed Contact</li>\n <li>Bounced Contact</li>\n <li>Lead Owner Email Address</li>\n</ul>\n# You may also specify any active Custom Field', | |
# 'parameters': [{'name': 'contacts', 'optional': False, 'type': 'array'}, | |
# {'name': 'overwrite', 'optional': False, 'type': 'boolean'}, | |
# {'name': 'contact_import_mapping', 'optional': False, 'type': 'array'}, | |
# {'name': 'contact_import_name', 'optional': False, 'type': 'string'}, | |
# {'name': 'notification_recipients', 'optional': False, 'type': 'array'}, | |
# {'name': 'add_to_lists', 'optional': False, 'type': 'array'}, | |
# {'name': 'remove_from_lists', 'optional': False, 'type': 'array'}], | |
# 'returns': 'integer', | |
# 'transport': 'POST'}}, | |
# 'target': '/api/v2/rpc/server.php?Controller=Contact', | |
# 'transport': 'POST'} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment