{"id":18273233,"url":"https://github.com/spacetab-io/onelya-python-sdk","last_synced_at":"2025-06-26T02:05:25.938Z","repository":{"id":57448738,"uuid":"113461870","full_name":"spacetab-io/onelya-python-sdk","owner":"spacetab-io","description":"Python SDK to work with Onelya API (smarttravel).","archived":false,"fork":false,"pushed_at":"2020-03-10T17:11:12.000Z","size":230,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-20T17:09:59.124Z","etag":null,"topics":["mit-license","onelya","opensource","railway","rzd","sdk","sdk-python","ufs","we-are-not-waiting"],"latest_commit_sha":null,"homepage":"https://in.smarttravel.ru","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/spacetab-io.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":"2017-12-07T14:39:38.000Z","updated_at":"2025-06-17T13:10:43.000Z","dependencies_parsed_at":"2022-09-26T17:31:41.894Z","dependency_job_id":null,"html_url":"https://github.com/spacetab-io/onelya-python-sdk","commit_stats":null,"previous_names":["tmconsulting/onelya-python-sdk"],"tags_count":25,"template":false,"template_full_name":null,"purl":"pkg:github/spacetab-io/onelya-python-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacetab-io%2Fonelya-python-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacetab-io%2Fonelya-python-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacetab-io%2Fonelya-python-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacetab-io%2Fonelya-python-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spacetab-io","download_url":"https://codeload.github.com/spacetab-io/onelya-python-sdk/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spacetab-io%2Fonelya-python-sdk/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260985211,"owners_count":23092889,"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":["mit-license","onelya","opensource","railway","rzd","sdk","sdk-python","ufs","we-are-not-waiting"],"created_at":"2024-11-05T12:05:43.200Z","updated_at":"2025-06-26T02:05:25.909Z","avatar_url":"https://github.com/spacetab-io.png","language":"Python","readme":"Onelya Python SDK [![master](https://circleci.com/gh/tmconsulting/onelya-python-sdk/tree/master.svg?style=shield)](https://circleci.com/gh/tmconsulting/onelya-python-sdk/tree/master)\n---------------\n\nThis SDK is used to connect to the Onelya and use it methods(Railway and Aeroexpress) for a 3-d party API.\n\n* [Installation](#installation)\n* [Get started](#get-started)\n* [Api Reference](#api-reference)\n* [Contact us](#contact-us)\n* [License](#license)\n\n\n### Installation\n```\npip3 install onelya_sdk\n```\n\n### Get started\n\nTo start you will need to have credentials for the Onelya. \u003cbr\u003e\nExample of api initializing\n\n```python\nfrom onelya_sdk import API\n\napi = API('username', 'password', 'pos')\n\n```\n\nAfter that, include the wrappers for requests to Railway Reservation\n\n```python\nfrom onelya_sdk.railway import *\n```\n\nNow you can use all the methods of the Onelya Railway.\n\nIf field type in docs represented as datetime, then you need to pass it as datetime object, **not** str\n\nFor example:\n\nE.g [Railway/Search for route pricing](https://test.onelya.ru/ApiDocs/Api?apiId=Railway-V1-Search-RoutePricing):\n\n```python\nfrom datetime import datetime\n\ndate = datetime.now()\nroute_pricing = api.railway_search.route_pricing('2000000', '2078750', date)\n```\n\nNow the result will be an instance of RoutePricing\n\n#### Request with wrappers\n```python\nproduct_request = ProductRequest('AccidentAndLuggageLossAndDamage')\nservice_add_upsale_request = ServiceAddUpsaleRequest('Igs', [1389, 1390], product_request)\nadd_upsale = api.railway_reservation.add_upsale(51978, 52919, service_add_upsale_request)\n```\n\n#### Results\nAll methods, except the `railway_reservation.return_amount`, return instance of class that contains all fields as a class variables and json_data variable with response json\n\nE.g. [References for balances](https://test.onelya.ru/ApiDocs/Api?apiId=Partner-V1-Info-Balances)\n\n```python\napi = API(self.username, self.password, self.pos)\nbalances = api.partner_balances()\n\nbalances.account_balances #array of AgentAccount\n\nbalances.account_balances[0].current_balance # 1 902 157,38\nbalances.account_balances[0].account_name # ???? ???? (??????????????)1\n\nbalances.account_balances[1].current_balance # 17 991 136,47\nbalances.account_balances[1].account_name # ?? ???? (????????)2\n```\n`balances.json_data`\n```json\n{\n  \"AccountBalances\": [\n    {\n      \"CurrentBalance\": \"1 902 157,38\",\n      \"AccountName\": \"???? ???? (??????????????)1\"\n    },\n    {\n      \"CurrentBalance\": \"17 991 136,47\",\n      \"AccountName\": \"?? ???? (????????)2\"\n    }\n  ]\n}\n```\n\n\n\n#### Handling errors\n\nEvery method returns an objects with result or raise an error fo OnelyaAPIError\n\nOnelya contains all data about error as in [docs](https://test.onelya.ru/ApiDocs/ErrorCodes)\n\nAdditionally returns docs url for method which raised an error\n\nE.g.\n```python\nblank_as_html = api.railway_search.route_pricing(-1, -1, None)\n```\nOnelyaAPIError output\n```\nonelya_railway_sdk.exceptions.OnelyaAPIError: Code: 43\n  Message: ???????????? ???????? ?????????(??) 'DepartureDate'\n  MessageParams: {'DepartureDate': None}\n  Docs: https://test.onelya.ru/ApiDocs/Api?apiId=Railway-V1-Search-RoutePricing\n\n```\n\n### API Reference\n\nTo use any of methods, you have to create an instance of Onelya.\nDescribed [here](#get-started)\n\nCurrently available methods:\n\n* [Railway](https://test.onelya.ru/ApiDocs/Railway)\n* [References](https://test.onelya.ru/ApiDocs/References).\n\n### Contact us.\n\nIf you have any issues or questions regarding the API or the SDK it self, you are welcome to create an issue, or\nYou can write an Email to `artyom.slobodyan@gmail.com` or `roquie0@gmail.com`\n\n### License.\n\nSDK is released under the [MIT License](./LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspacetab-io%2Fonelya-python-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspacetab-io%2Fonelya-python-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspacetab-io%2Fonelya-python-sdk/lists"}