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

Sign up
Appearance settings

[Bitbucket] Push/edit file using Repository Access token #1107

Open
Labels
bitbucketAtlassian Bitbucket (Cloud or Server) help wanted
@kaushalkrishna2000

Description

Bitbucket released repository access token for controlled access to just one repository.
The python wrapper is throwing the error.
"When performing an edit, the author must have an e-mail address."

I need to know is there any way to include email/username in the requests payload ?

For eg.

from variables import *
import requests
import logging
logger=logging.getLogger()
logging.basicConfig(filename = 'myfile1.log', level=logging.DEBUG,
 format='%(filename)s:%(lineno)s %(levelname)s:%(message)s')
url = f"https://{base_url}/rest/api/latest/projects/~{username}/repos/{repo}/browse/{file}"
contents=None
with open(file,"r") as f:
 contents=f.read()
payload={
 "content": contents,
 "message": "Holla",
 "branch": "master",
 "sourceCommitId": "b244ade3b96",
}
data={
 "author":{
 "name":"example",
 "emailAddress":"ex@example.com"
 }
 }
headers = {
 "Accept": "application/json",
 "Authorization": f"Bearer {auth}"
}
response = requests.request(
 "PUT",
 url=url,
 headers=headers,
 files=payload,
 '''maybe add a json or data payload'''
)
print(response)
print(response.content)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bitbucketAtlassian Bitbucket (Cloud or Server) help wanted

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /