-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PyCrits bug - Campaign by Name #2
Comments
This is by design, though I'm open to suggestions on how to make it better. This is the code for campaign_by_name():
c-name is not parsed in campaign_by_name, it is set to whatever the required argument (name) is. In your first example the params dictionary passed to
This is wrong for obvious reasons. The second example you give works, but the params option is unncessary as c-name is set in campaign_by_name. The correct way to call campaign_by_name if you have a name and no parameters is:
If you have any parameters you want to pass along, like say only return the id, then you can do this:
|
Ah OK, got it. I had a feeling it was by design but couldn't figure it out by eye. |
Yeah, I'm open to suggestions on how anyone thinks this should be done. Might as well provide a bit of background and use this issue to open up the discussion if anyone wants to chime in. I designed the API to be as light-weight as possible. The idea was to make getting objects easy but it does require you to know what is and is not possible via the CRITs API. For example, to search for a sample via md5 you have to do this:
You have to know that I know I've had discussions with @wick2o about taking a different approach, which I'm certainly open to seeing a straw-man implementation of. His argument is essentially that we should mirror the CRITs object model and expose that. So querying for a specific sample by md5 becomes this (pseudo-code):
The upside of this is that consumers of the API don't need to know about I think one possibility might be to maintain both models? I'm certainly open to discussion here. |
Hi,
When executing the following code, the campaign is not retrieved successfully:
from pycrits import pycrits
crits = pycrits(uri,username,api_key)
params = { 'c-name' : 'somecampaign' }
print crits.campaign_by_name(params)
However, the following does allow you to retrieve it.
from pycrits import pycrits
crits = pycrits(uri,username,api_key)
params = { 'c-name' : '' }
print crits.campaign_by_name('somecampaign',params)
Not sure if this is by design, but given that an arg 'c-name' is parsed from campaign_by_name i would have expected it to be used in the query.
Cheers,
Tom
The text was updated successfully, but these errors were encountered: