Comments (10)
maybe improve this way:
filters = panel.get('segmentGroups')
if filters is not None:
for element in filters:
That being said, it is a bit dangerous to expect a certain model from a non-officially supported API. I would prefer just getting (or via an optional parameter) the raw JSON back and then be able to do what I need with it. I need to roll back to 0.2.4 now.
from adobe-analytics-api-2.0.
Boy sorry for the many messages, but I think you already had this option in mind with the projectClass parameter, however:
if projectClass:
if verbose:
print('building an instance of Project class')
myProject = Project(res)
return myProject
self.projectsDetails[projectId] = Project(res) !!! Response is forced into "Project" even when projectClass is False
from adobe-analytics-api-2.0.
Yeah it totally makes sense to cache the object in a certain standard data model, I was not disputing that, I just wondered why you forced this, relying on a certain model that may change soon as it is as you say unsupported and undocumented.
I hugely appreciate it anyway and I am aware of the potential problems that come with it. THANKS!
My scripts don't need to cache the project definition however and memory is always a potential issue, so being able to skip this row "self.projectsDetails[projectId] = Project(res)" entirely with a flag (e.g. cache=False) would be even a bit more performance and memory-saving.
from adobe-analytics-api-2.0.
I opened the project from the AA interface and saved it again. Now it worked. But there seems to be some issue with older projects.
I had the issue again with another project now, but I cannot see what the issue is. The workspace looks like a normal one. It was last modified in 2017 however. If there was some "open, save and close" workspace function in the API, we could work around such cases by simply re-saving the wspaces with modern definitions.
from adobe-analytics-api-2.0.
The problem is the new way that the response of the getProject request is forced into -> Union[dict,Project]
Here it tries to get a "segmentGroups" property which does not exist in all projects:
for panel in workspace['panels']:
if "reportSuite" in panel.keys():
dict_elements['reportSuites'].append(panel['reportSuite']['id'])
elif "rsid" in panel.keys():
dict_elements['reportSuites'].append(panel['rsid'])
filters: list = panel['segmentGroups']
if len(filters) > 0:
The row where it breaks: filters: list = panel['segmentGroups']
This also explains why it did not cause issues before, only after updating the aa2 library yesterday.
from adobe-analytics-api-2.0.
I will send you an example response of such projects via email. As I said, I would want an option that prevents forcing the response into the Project dictionary.
from adobe-analytics-api-2.0.
Thanks a lot @loldenburg for the debug.
For the last message, I am trying to be smart (It doesn't suit me well apparently).
The idea is to cache the Project detail in an attribute (dictionary) so you can easily access them later on again if you need to.
So you don't need to do an API call again (as it is expensive in time and in API call budget - limit of 12 for 6s)
I replace it with a try:
try:
self.projectsDetails[projectId] = Project(res)
except:
if verbose:
print('WARNING : Cannot convert Project to Project class')
For the original fail, I will fix it by returning an empty list:
filters: list = panel.get('segmentGroups',[])
As I am doing a if len(filters) > 0:
later on.
EDIT : btw I am so happy I have set some type hint along the way so I now what I am supposed to expect.(the : list
).
I encourage to do that when it is not up to you.
True, it is tough to expect anything from undocumented (unsupported?) API.
I still see lots of benefits from it though :)
from adobe-analytics-api-2.0.
I hope to make the changes tonight for an update in Git tomorrow.
Probably be a Patch (something like "0.2.6-1")
from adobe-analytics-api-2.0.
Sound argument. I'll add that option (and set it to False by default).
False = It is not cache by default.
from adobe-analytics-api-2.0.
Enhancement part of the 31fd34f commit.
fyi : I messed up the version number, the new version is 0.2.6
not the 0.2.6-1
You may have hard time installing it if you try a pip upgrade and you currently have the 0.2.6-1
.
Nothing change except that part and some release info.
So you can stay with the 0.2.6-1
from adobe-analytics-api-2.0.
Related Issues (20)
- Dimension API is returning up to 3 Elements in Support Value list HOT 4
- findComponentsUsage KeyError: 'reportlet' HOT 8
- UnboundLocalError: local variable 'myProjectDetails' referenced before assignment HOT 5
- Issue with getUsagelogs method HOT 10
- Data warehouse method HOT 1
- getReport does not work with RequestCreator HOT 2
- [Bug] Statistics needed in getReport2() HOT 5
- createConfigFile() Improved argument parsing HOT 3
- getUsagelogs returning KeyError 'Content' HOT 7
- getReport2 fails if dimensional value filters are used as segments HOT 5
- Limit HOT 2
- Feature Request: Ability to pass through a logging.formatter class to the logger. HOT 2
- Bug: DataFrame obtained from getReport method not matching table seen in Adobe Analytics portal. HOT 3
- Updating segment error HOT 1
- Feature Request: getRequests() Method HOT 1
- getReport methods do not accept requests without a dimension HOT 6
- Pandas error from getReport2 (for a request with no dimensions and no STATIC_ROW_COMPONENT. HOT 3
- getReport2 returns incorrect numbers for metrics/pageviews. HOT 7
- getReport2 should not rewrite the request HOT 12
- getRequest2 method returning 0 rows for all json requests. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from adobe-analytics-api-2.0.