{"repo": "sporteasy/python-poeditor", "pull_number": 5, "instance_id": "sporteasy__python-poeditor-5", "issue_numbers": "", "base_commit": "8373565434d5c62c6409ca54ca629f192b45799e", "patch": "diff --git a/poeditor/client.py b/poeditor/client.py\n--- a/poeditor/client.py\n+++ b/poeditor/client.py\n@@ -11,8 +11,8 @@\n import json\n from datetime import datetime\n import tempfile\n-from restkit import Resource, request\n \n+import requests\n \n __all__ = ['POEditorException', 'POEditorArgsException', 'POEditorAPI']\n \n@@ -74,19 +74,22 @@ def _run(self, action, headers=None, **kwargs):\n \"\"\"\n Requests API\n \"\"\"\n- res = Resource(self.HOST)\n payload = kwargs\n payload.update({'action': action, 'api_token': self.api_token})\n- response = res.post(payload=payload, headers=headers)\n+ if payload.get('file'):\n+ file = {'file': payload.pop('file')}\n+ response = requests.post(url=self.HOST, data=payload, headers=headers, files=file)\n+ else:\n+ response = requests.post(url=self.HOST, data=payload, headers=headers)\n \n- if response.status_int != 200:\n+ if response.status_code != 200:\n raise POEditorException(\n status='fail',\n- error_code=response.status_int,\n- message=response.status\n+ error_code=response.status_code,\n+ message=response.reason\n )\n \n- data = json.loads(response.body_string().decode('utf-8'))\n+ data = json.loads(response.text)\n \n if 'response' not in data:\n raise POEditorException(\n@@ -375,7 +378,7 @@ def export(self, project_id, language_code, file_type='po', filters=None,\n file_url = data['item']\n \n # Download file content:\n- res = request(file_url)\n+ res = requests.get(file_url, stream=True)\n if not local_file:\n tmp_file = tempfile.NamedTemporaryFile(\n delete=False, suffix='.{}'.format(file_type))\n@@ -383,12 +386,8 @@ def export(self, project_id, language_code, file_type='po', filters=None,\n local_file = tmp_file.name\n \n with open(local_file, 'w+b') as po_file:\n- with res.body_stream() as body:\n- while True:\n- data = body.read(1024)\n- if not data:\n- break\n- po_file.write(data)\n+ for data in res.iter_content(chunk_size=1024):\n+ po_file.write(data)\n return file_url, local_file\n \n def _upload(self, project_id, updating, file_path, language_code=None,\n@@ -421,7 +420,6 @@ def _upload(self, project_id, updating, file_path, language_code=None,\n sync_terms = None\n \n # Special content type:\n- headers = {'Content-Type': 'multipart/form-data'}\n tags = tags or ''\n language_code = language_code or ''\n sync_terms = '1' if sync_terms else '0'\n@@ -439,7 +437,7 @@ def _upload(self, project_id, updating, file_path, language_code=None,\n sync_terms=sync_terms,\n overwrite=overwrite,\n fuzzy_trigger=fuzzy_trigger,\n- headers=headers\n+ headers=None\n )\n return data['details']\n \ndiff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -24,9 +24,10 @@\n 'Natural Language :: English',\n 'Programming Language :: Python',\n 'Programming Language :: Python :: 2.7',\n+ 'Programming Language :: Python :: 3',\n \"Topic :: Software Development :: Localization\",\n ],\n- install_requires=['restkit'],\n+ install_requires=['requests'],\n license='MIT',\n test_suite=\"nose.collector\",\n )\n", "test_patch": "", "problem_statement": "", "hints_text": "", "created_at": "2017-02-07T11:06:23Z"}