-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create_Attachment doesn't seem to work #322
Comments
I'm experiencing this as well in October of 2023. from azure.devops.connection import Connection
from azure.devops.v7_0.git.git_client import GitClient
from azure.devops.v7_0.git.models import *
from msrest.authentication import BasicAuthentication
from pathlib import Path
# Insert your own credentials/IDs here
personal_access_token = "notarealpersonalaccesstoken"
organization_url = "https://dev.azure.com/notarealorganization"
authentication = BasicAuthentication("", personal_access_token)
repository_id = "some-letters-and-numbers"
pull_request_id = 123456
connection = Connection(organization_url, authentication)
client: GitClient = connection.clients.get_git_client()
# Open file and call create attachment
# Expect file to be in same directory as script
file_name = "test.jpg"
upload_path = Path(__file__).parent / file_name
with upload_path.open("rb") as upload:
result = client.create_attachment(upload, file_name, repository_id, pull_request_id)
print(result) When I run this code, I receive the following error:
Currently, I'm using Python 3.7.4 with azure-devops 7.1.0b3. I can also vouch that using the |
The python create_attachment call in the git client doesn't seem to work correctly. If you use it as currently implemented you get a 'azure.devops.exceptions.AzureDevOpsServiceError: Nullable object must have a value' exception.
I saw the example as part of issue 129: #129 but that throws the same exception.
If I instead change the create_attachment call to:
things work.
The text was updated successfully, but these errors were encountered: