Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions 8 gitlab/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import warnings

import requests
from requests_toolbelt.multipart.encoder import MultipartEncoder

import gitlab.config
from gitlab.const import * # noqa
Expand Down Expand Up @@ -500,9 +501,12 @@ def http_request(

# We need to deal with json vs. data when uploading files
if files:
data = post_data
my_data = post_data
json = None
del opts["headers"]["Content-type"]
my_data["file"] = files["file"]
files = None
data = MultipartEncoder(my_data)
opts["headers"]["Content-type"] = data.content_type
else:
json = post_data
data = None
Expand Down
4 changes: 2 additions & 2 deletions 4 gitlab/v4/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -4792,8 +4792,8 @@ def import_project(
Returns:
dict: A representation of the import status.
"""
files = {"file": ("file.tar.gz", file)}
data = {"path": path, "overwrite": overwrite}
files = {"file": ("file.tar.gz", file, 'application/octet-stream')}
data = {"path": path, "overwrite": str(overwrite)}
if override_params:
for k, v in override_params.items():
data["override_params[%s]" % k] = v
Expand Down
1 change: 1 addition & 0 deletions 1 requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
requests>=2.22.0
requests-toolbelt>=0.9.1
2 changes: 1 addition & 1 deletion 2 setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def get_version():
license="LGPLv3",
url="https://github.com/python-gitlab/python-gitlab",
packages=find_packages(),
install_requires=["requests>=2.22.0"],
install_requires=["requests>=2.22.0", "requests-toolbelt>=0.9.1"],
python_requires=">=3.6.0",
entry_points={"console_scripts": ["gitlab = gitlab.cli:main"]},
classifiers=[
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.