Code Monkey home page Code Monkey logo

pyamc's Introduction

AdobeAnalytics

Build Status

Synopsis

This is a python wrapper ready for the SiteCatalyst (Adobe Analytics) API 1.4

Code Example

I made this package to simplify pulling data from SiteCatalyst. It is very flexible and accept any json that is valid from the API explorer values = {} omni_api(values)

Motivation

This is the easiest way to get data from Adobe to accomplish your goals.

Installation

pip install AdobeAnalytics

Tests

Still working on this part

Contributors

Andy Maheshwari, Randy Zwitch. Feel free to drop me a line at [email protected]

License

MIT License

pyamc's People

Contributors

andymaheshw avatar randyzwitch avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

pyamc's Issues

Auto-convert input types for rsid_list

It's semi-annoying to have to wrap the input for a single report suite for each function. For example:

Want this:

aaa.GetBaseCurrency("zwitchdev")

Need to do:
aaa.GetBaseCurrency(rsid_list = ["zwitchdev"])

Decide on package name

pyadobemc not the greatest name, just used it to disambiguate the from adobeanalytics import AdobeAnalytics issues I was encountering.

Surprisingly, pyamc doesn't appear to be used by anyone (amc = Adobe Marketing Cloud).

Suggestions?

Python 3 compatibility

This package doesn't work with Python 3; the error has to do with the header building function. The SHA1 function doesn't like the str type, and you can't just append unicode strings together.

This is hopefully the only compatibility issue.

Documentation

@andymaheshw Can you go into the settings page and set up GitHub Pages? Probably want to choose the option for placing the files in the docs directory on the master branch. If it doesn't give you that option, then you need to create the docs directory first.

Roadmap

Hey Andy -

Starting a repo, successful first step! Although I presume your code works, I haven't tested it yet.

Here are some ideas for the next set of changes:

Current Code:

  • The sha module is deprecated, so switch to hashlib instead. You should probably use the requests library as well, instead of urllib2, as requests is newer and made to be more reasonably easy to use
  • Even though the user will be providing their username and shared_secret, I think these should be private attributes by default. Use two leading underscores to "hide" a variable inside a class.
  • By convention, follow the PEP-8 style guide. Make the adobeanalytics class AdobeAnalytics instead. https://www.python.org/dev/peps/pep-0008/#class-names
  • Make a fully-installable package before getting started. The package would be named adobeanalytics or similar, then your class would be AdobeAnalytics, so that users would type
from adobeanalytics import AdobeAnalytics

Future Code

In general, your code would work, but I suggest you think about any functions or methods as a single unit that do one thing. So the workflow of an API call would be something like the following:

  1. User creates AdobeAnalytics object as the following:
aa = AdobeAnalytics(user_name = , shared_secret= )

The result of this should NOT return anything to stdout; my R version is a hack, because it's not clear anything happens because I don't assign anything in the global namespace per CRAN rules, so I print a message out to show the user something happens. That's not necessary in Python, because the aa object will exist globally.

As part of the init process, you should allow the user to specify their endpoint; additionally, should the user not specify an endpoint, you should call GetEndpoint from the Adobe API to find out what endpoint someone is using

  1. With the aa object available, users will now call all methods from here. Although PEP8 states that methods should be lower case or lowercase with underscores, my opinion is that you should follow the Adobe convention of CamelCase. So users would call methods such as aa.GetReportSuites() to get their list of report suites
  2. For each API call, break up the flow into the following:
  • User specifies arguments to method
  • method converts arguments to JSON call
  • method makes API call
  • method receives response (either report_id or immediate response)
  • If method receives a report_id, then need to repeatedly check to see if report is ready. If API call returns immediately, you'll get JSON back
  • Eventually, the report is ready, and you have JSON
  1. At this point, returning JSON as a Python Dict should be a valid state. Python users are used to this, whereas in R, I force everything to a data frame because there are no dicts in R and users are more used to dataframes.
  2. Write dataframe parsers :) Even though the Adobe JSON is horrid, it's mostly possible to return a data frame without much effort. At first, this should probably be a method, but it could be a keyword argument eventually in a method call (so that people can specifiy getting a Dict or pandas Data Frame back)

Of course, this is very high level, so feel free to ask questions as you go along. I'll be able to contribute code to this as well, since I want a Python library myself; just let me know what you are working on so we don't duplicate effort.

issue with travis.ci

Hi Randy,

I saw the travis build wasn't responding correctly, is there anything I can help with?

ERROR: InvocationError: '/home/travis/build/andymaheshw/AdobeAnalytics/.tox/check/bin/flake8 src tests setup.py'
___________________________________ summary ____________________________________
ERROR: check: commands failed

Add pandas functionality

Have a kw argument for each function, set to True, so that each function returns a pandas dataframe instead of a list/Dict combo

This is a lot of work :)

ci files...

Hey Randy,

What are the ci files? Sorry to bug you about it. Thanks!

tests

Hi Randy, I created the testing branch, I'll get them done soon.

I think we're all set after tests right? We just need to push to pypi?

Set up TravisCI testing

This is two parts, maybe I can tackle this today since a bunch of people are out of the office:

  1. Writing tests: this is pretty obvious, we can write test(s) for the functions to ensure future changes don't break existing code
  2. Set up TravisCI for continuous integration testing. I have a Travis account and I personal Adobe account, so we can use those credentials (so that it doesn't matter we either of us works in the future :))

Implement remaining GET requests

While all of the GET functions appear to be stubbed out (nice!), the following do not work (either because they aren't implemented, use the wrong keyword names or are missing keyword arguments)

  • GetClassifications
  • GetElements
  • GetFeed
  • GetFeeds
  • GetMetrics
  • GetRealTimeReport
  • GetReportDescription
  • GetTrackingServer

@andymaheshw is this something you want to take or do you want me to implement these?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.