# -*- coding: utf-8 -*-
from distutils.core import setup

packages = \
['transformer', 'transformer.plugins']

package_data = \
{'': ['*']}

install_requires = \
['chevron>=0.13,<0.14',
 'docopt>=0.6.2,<0.7.0',
 'ecological>=1.6,<2.0',
 'pendulum>=2.0,<3.0']

entry_points = \
{'console_scripts': ['transformer = transformer:cli.script_entrypoint']}

setup_kwargs = {
    'name': 'har-transformer',
    'version': '1.0.2.dev20190213164549',
    'description': 'A tool to convert HAR files into a locustfile.',
    'long_description': '<p align="center"><img src="images/transformer.png"/></div>\n\n[![Build Status](https://travis-ci.org/zalando-incubator/Transformer.svg?branch=master)](https://travis-ci.org/zalando-incubator/Transformer)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/10b3feb4e4814429bf288b87443a6c72)](https://www.codacy.com/app/thilp/Transformer?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=zalando-incubator/Transformer&amp;utm_campaign=Badge_Grade)\n\n# Transformer\n\nA tool to transform/convert web browser sessions ([HAR files][]) into\n[Locust][] load testing scenarios (locustfile).\n\nThis tool can be used when you have HAR files (containing recordings of\ninteractions with your website) that you then want to replay in load tests\nusing Locust.\n\n[HAR files]: https://en.wikipedia.org/wiki/.har\n[Locust]: https://locust.io/\n\n<!-- toc -->\n\n- [Installation](#installation)\n- [Usage](#usage)\n- [How-to](#how-to)\n  * [Create a HAR file](#create-a-har-file)\n    + [Using Chrome Developer Tools](#using-chrome-developer-tools)\n  * [Scenario weights](#scenario-weights)\n  * [Hierarchical scenarios](#hierarchical-scenarios)\n  * [Blacklist specific URLs](#blacklist-specific-urls)\n  * [Use plugins](#use-plugins)\n- [Contributing](#contributing)\n- [Versioning](#versioning)\n- [Authors](#authors)\n- [License](#license)\n\n<!-- tocstop -->\n\n## Installation\n\nInstall from PyPI with pip:\n\n```bash\npip install har-transformer\n```\n\n## Usage\n\nImport in your code and use it:\n```python\nfrom transformer import transform\n\nwith open("locustfile.py", "w") as locust_file:\n  locust_file.write(transform.main("scenarios_directory/"))\n```\n\nExample HAR files are included in the `examples` directory for you to try out.\n\n## How-to\n\n### Create a HAR file\n\n#### Using Chrome Developer Tools\n\n__Record__\n\n1. __Prepare your scenario__ by thinking through the steps you want to execute\n2. Open __Chrome__ in either __Guest__ or __Incognito__ mode (it\'s important to have no cookies prior to starting)\n3. Open the [Developer Tools][]\n4. Open the __Network__ panel\n5. Select __Disable cache__ and __Preserve log__\n6. Clear the existing log by clicking the __Clear__ :no_entry_sign: button\n7. Ensure recording is enabled, the __Record__ button should be red  :red_circle: (click to toggle)\n8. __Navigate__ to your target site by entering the URL in the address bar e.g. https://www.zalando.de, https://www.zalando.de/damen-home/, etc.\n9. __Perform your scenario__ by clicking through the pages, filling in forms, clicking buttons etc.\n\n__N.B.__ It\'s recommend that after each click/action, and before the next one, you wait until the network panel stops showing activity. This is to ensure that all requests are properly recorded.\n\n[Developer Tools]: https://developers.google.com/web/tools/chrome-devtools/network-performance/\n\n__Save__\n\nOnce you have finished performing your scenario:\n\n1. __End recording__ by clicking the Record :red_circle: button\n2. __Right-click__ on any of the file names listed in the bottom pane of the Network panel\n3. Select __Save as HAR with content__\n4. __Save__ the file on your machine\n\nℹ️  _You can view the details of the recorded HAR by simply drag-and-dropping it into the Chrome Developer Tools Network panel._\n\n### Scenario weights\n\nBy default, all scenarios have the same weight 1, which means they should all be\nexecuted as often as the others.\n\nYou can specify a different weight for each HAR file by creating an associated\nweight file. Weights must be positive, non-null integers due to how Locust works.\nConsider the following scenario group:\n\n```bash\n$ ls\nscenario1.har\nscenario2.har\nscenario2.weight\n\n$ cat scenario2.weight\n3\n```\n\nHere are the weights Transformer will specify in the corresponding locustfile:\n\n| Scenario        | Weight |\n| --------------- | ------ |\n| `scenario1.har` | 1      |\n| `scenario2.har` | 3      |\n\nThis means that Locust will run `scenario2.har` 3 times as much as\n`scenario1.har`.\n\n### Hierarchical scenarios\n\nIt may be the case that all your scenarios cannot be treated the same:\n\n- some only apply to a part of your load test target,\n- some should run more often than others.\n\nFor instance, the Zalando website works differently depending on its top-level\ndomain: zalando.fr has an additional step before payment compared to zalando.de.\nThis requires using different scenarios (i.e. different HAR files) depending on\nthe tested domain.\nMoreover, to execute a realistic load test, we need to produce much more traffic\ntargeting certain countries (i.e. groups of scenarios) than others.\n\nTo accommodate this way of working, our HAR files are organized in TLD-specific\ndirectories, each of which is potentially associated to a specific "weight"\naccording to the relative amount of traffic expected:\n\n```\nscenarios/\n├── Germany/\n│   ├── scenario_1.har\n│   ├── scenario_2.har\n│   └── scenario_2.weight\n├── Germany.weight\n├── Switzerland/\n│   └── scenario_1.har\n└── Switzerland.weight\n```\n\nThe "weight file" of directories (`Germany.weight`, `Switzerland.weight`) are\nsimilar to [scenario weight files](#scenario-weights) but apply to the whole\ndirectory (relatively to other directories of the same level).\nThus, in the previous example, if `Germany.weight` is `6` and\n`Switzerland.weight` is `2`, then Germany scenarios will be executed (in total)\n3 times more (6 / 2) than Switzerland scenarios.\nA directory without a weight file has a weight of 1.\n\nScenarios can be arbitrarily nested, allowing you to organize and weight them as\nyou want:\n\n```\nscenarios/\n├── Germany/\n│   ├── beauty/\n│   │   └── checkout.har\n│   ├── kids/\n│   │   └── frontpage.har\n│   ├── kids.weight\n│   └── scenario_1.har\n├── Germany.weight\n├── Switzerland/\n│   └── scenario_1.har\n└── Switzerland.weight\n```\n\nTo represent this, Transformer will produce nested\n[Locust TaskSets](https://docs.locust.io/en/stable/writing-a-locustfile.html#tasksets-can-be-nested)\nin the resulting locustfile.\n\n### Blacklist specific URLs\n\nBy default, Transformer converts all requests found in input HAR files.\nYou can blacklist, i.e. ignore, certain URLs by creating a `.urlignore` file in the directory\nin which Transformer is called.\n\n__Example__\n\nA `.urlignore` containing:\n```\ngoogle\nwww.facebook.com\nhttps://mosaic\n```\n\n... would ignore requests with URLs such as `https://www.google.com`, `https://www.facebook.com/`, and\n`https://mosaic01-abc.js` (amongst others).\n\nAn example blacklist file called [`.urlignore_example`](transformer/.urlignore_example) exists\nthat you can use as a base.\n\n### Use plugins\n\nIn case you need some customization of the Locustfile generated by Transformer, you can use its plugin\nmechanisms to achieve it. Please see [`plugins` documentation](transformer/plugins) for more details.\n\n## Contributing\n\nPlease read [CONTRIBUTING.md](CONTRIBUTING.md) for details on our process for\nsubmitting pull requests to us, and please ensure\nyou follow the [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md).\n\n[Poetry]: https://poetry.eustace.io/docs/#installation\n\nThe only required dependency for local development is [Poetry][].\n\nWith Poetry, our `Makefile` installs all necessary dependencies\nand run all tests and linters:\n\n```bash\nmake\n```\n\n## Versioning\n\nWe use [SemVer](http://semver.org/) for versioning. For the versions available,\nsee the [tags on this repository](https://github.com/zalando-incubator/transformer/tags).\n\n## Authors\n\n* **Serhii Cherniavskyi** - [@scherniavsky](https://github.com/scherniavsky)\n* **Thibaut Le Page** - [@thilp](https://github.com/thilp)\n* **Brian Maher** - [@bmaher](https://github.com/bmaher)\n* **Oliwia Zaremba** - [@tortila](https://github.com/tortila)\n\nSee also the list of [contributors](CONTRIBUTORS.md) who participated in this project.\n\n## License\n\nThis project is licensed under the MIT License - see the\n[LICENSE.md](LICENSE.md) file for details.\n',
    'author': 'Serhii Cherniavskyi',
    'author_email': 'serhii.cherniavskyi@zalando.de',
    'url': 'https://github.com/zalando-incubator/transformer',
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'entry_points': entry_points,
    'python_requires': '>=3.6,<4.0',
}


setup(**setup_kwargs)
