{"id":19560582,"url":"https://github.com/buzzfeed/python-operative","last_synced_at":"2025-02-26T08:41:15.746Z","repository":{"id":57457340,"uuid":"12221814","full_name":"buzzfeed/python-operative","owner":"buzzfeed","description":"Python bridge for Operative","archived":false,"fork":false,"pushed_at":"2014-07-21T19:52:57.000Z","size":284,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":269,"default_branch":"master","last_synced_at":"2025-01-08T22:43:11.310Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/buzzfeed.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-08-19T16:39:43.000Z","updated_at":"2018-10-11T15:16:44.000Z","dependencies_parsed_at":"2022-09-05T20:01:30.545Z","dependency_job_id":null,"html_url":"https://github.com/buzzfeed/python-operative","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buzzfeed%2Fpython-operative","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buzzfeed%2Fpython-operative/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buzzfeed%2Fpython-operative/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/buzzfeed%2Fpython-operative/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/buzzfeed","download_url":"https://codeload.github.com/buzzfeed/python-operative/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240822615,"owners_count":19863302,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T05:08:05.523Z","updated_at":"2025-02-26T08:41:15.689Z","avatar_url":"https://github.com/buzzfeed.png","language":"Python","readme":"python-operative\n=========\n**python-operative** is a very light-weight Python bridge to the Operative FTP flatfile system.\n\nSetup\n-----\n\nSetup virtualenv:\n```\n$ mkvirtualenv --distribute python-operative\n$ workon python-operative\n```\n\nRun installation script:\n```\n$ python setup.py install\n```\n\nTesting\n-------\n\nThere are two options for running the tests.\nIf you prefer not to test using a live FTP endpoint, then you can use the caliendo cache instead.\n\n###Using Live FTP endpoint\n\nCopy default settings file:\n```\ncp operative/settings.py.default operative/settings.py\n```\nUpdate the settings.py file with your own FTP credentials\n\n###Using caliendo cache\n\nSet caliendo env vars:\n```\n$ export USE_CALIENDO=True\n$ export CALIENDO_CACHE_PREFIX=/absolute/path/to/caliendo/dir\n```\n\nRun tests:\n```\n$ python setup.py nosetests\n```\n\nUsage\n-----\n\nUsing **python-operative** to retrieve data from an Operative flatfile report is very straightforward.\n\nFirst step is to define an FTPCredentials object:\n```python\nimport operative\n\nFTP_LOGIN_DICT = {\n    'host': \u003cstr\u003e,\n    'port': \u003coptional int\u003e,\n    'username': \u003cstr\u003e,\n    'password': \u003cstr\u003e}\n\nftp_creds = operative.FTPCredentials(**FTP_LOGIN_DICT)\n```\n\nFrom there you can pull an array of Report objects:\n```python\nimport datetime\nfrom operative.reports.line_item_report import LineItemReport\n\nsince = datetime.datetime.today() - datetime.timedelta(days=1)\npath = '/flatfile'\n\nline_item_reports = LineItemReport().get_report_files(ftp_credentials=ftp_creds, ftp_path=path, since=since)\n```\n\nEach Report object has a 'data' array attribute that represents the rows in the report.\nEach item in the 'data' array is a **python-operative** model. In the case of this example, they would be LineItem models.\n\nSee the [model definitions](https://github.com/buzzfeed/python-operative/blob/master/operative/models/__init__.py) for more info.\n\nExtending / Contributing\n------------------------\n\nIf you need to represent an Operative object that is not currently supported, then simply add it to the [model definitions](https://github.com/buzzfeed/python-operative/blob/master/operative/models/__init__.py).\n\nIf you need a report that is currently not supported, then add it to the [report definitions](https://github.com/buzzfeed/python-operative/tree/master/operative/reports).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuzzfeed%2Fpython-operative","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbuzzfeed%2Fpython-operative","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbuzzfeed%2Fpython-operative/lists"}