Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

SDK is very compatible with ipython, making the API much more useful for data analysis and debugging via python. 

Examples of SDK at work in ipython, including tab completion and documentation:

Image RemovedExample of tab completion

Code Block
In [1]: import springserve


In [2]: springserve.<tab>
	
	springserve.API		springserve.demand_tags		springserve.domain_lists	springserve.quality_reports
	springserve.raw_get		springserve.reports		springserve.setup_config	springserve.supply_tags	
	...


See documentation on the function of supply_tags

Code Block
In [3]: springserve.supply_tags.get?
    
Signature: springserve.supply_tags.get(path_param=None, reauth=False, **query_params)
Docstring:
Make a get request to this api service.  Allows you to pass in arbitrary query paramaters.

Examples::

    # get all supply_tags
    tags = springserve.supply_tags.get()

    for tag in tags:
        print tag.id, tag.name

    # get one supply tag
    tag = springserve.supply_tag.get(1)
    print tag.id, tag.name

    # get by many ids
    tags = springserve.supply_tags.get(ids=[1,2,3])

    # get users that are account_contacts (ie, using query string # params)
    users = springserve.users.get(account_contact=True)
File:      /usr/local/lib/python2.7/site-packages/springserve/__init__.py
Type:      instancemethod


Examples of simple functions to replace messy requests, plus more tab completion:

Code Block
# get a supply tag by its id
In [4]: tag = springserve.supply_tags.get(123)


In [5]: tag.<tab>
    tag.active                 tag.domain_list_ids        tag.player_size_targeting
    tag.supply_partner_id
    tag.allowed_player_sizes   tag.domain_targeting       tag.rate
    tag.supply_type
    tag.country_codes          tag.id                     tag.raw
    tag.country_targeting      tag.name                   tag.save
    tag.demand_tag_priorities  tag.payment_terms          tag.supply_group_id


# see contents of a field
In [6]: tag.name
Out [6]: "My test tag"


# change the field and save it
In [7]: tag.name = "My new test tag"


In [8]: resp = tag.save()

SDK will allow you to work more efficiently, we highly encourage you to use it for all your SpringServe API needs.  

...