Comments (10)
http://python-gitlab.readthedocs.org/en/latest/upgrade-from-0.10.html should help. Let me know if you need more information.
from python-gitlab.
I looked there, I looked into the code and it didn't help me.
Logic says that I need to pass to p.files.get(file_path, ref)
, but it doesn't work. What am I missing? Do I need to get branch first and then get files from the branch?
ie:
p = self.projects.get(id=project_id)
b = p.branch.get(ref=ref)
f = b.files.get(file_path).content
from python-gitlab.
You actually had the correct syntax but there's in bug in the BaseManager class that made your code fail. I pushed commit 0e0c81d which should fix it.
The syntax is:
p = gl.projects.get(some_project_id)
f = p.files.get(file_path=file_path, ref=ref)
content = base64.b64decode(f.content)
Could you confirm that the patch works for you? If it's OK I'll push a new release. Thank you.
from python-gitlab.
Yes, this changes solved the problem with the downloading of the file, but introduces a debug output from somewhere...
The only remaining case I have now is creating a note for the project.
Old code was:
p = self.projects.get(id=project_id).
i = p.issues.get(project_id=project_id, id=issue_id)
if i.canUpdate:
n = i.Note({
'project_id': project_id,
'issue_id': issue_id,
'body': body,
})
n.save()
Now replacing Note
into notes.create
:
>>> n = i.notes.create({'project_id': project_id, 'issue_id': issue_id, 'body': 'test'})
>>> n.save()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/b/.virtualenvs/bootstrap/lib/python2.7/site-packages/gitlab/objects.py", line 321, in save
self._update(**kwargs)
File "/home/b/.virtualenvs/bootstrap/lib/python2.7/site-packages/gitlab/objects.py", line 314, in _update
raise NotImplementedError
NotImplementedError
from python-gitlab.
Do I understand correctly, that n.save()
no longer required?
from python-gitlab.
n.save() is no longer needed. I'll check what's happening with the note creation.
from python-gitlab.
Then there is no issues with note creation.
Thank you.
from python-gitlab.
OK. Thank you for you report and tests!
from python-gitlab.
Please make sure to disable debug output you added recently :)
from python-gitlab.
It's done already :)
I'll push a new release after adding some unit and functional tests.
from python-gitlab.
Related Issues (20)
- Wrong type on `job.trace()`? HOT 3
- Missing `latest()` method on `ProjectPipelineManager` HOT 4
- Support group-level service-accounts
- Add group.shared_with_groups.list() HOT 2
- const module not exposed
- Missing content Class Variable in ProjectFile Class HOT 3
- Improve documentation on usage of Docker image directly within Gitlab CI HOT 1
- ProjectMergeRequestApprovalManager.set_approvers cannot handle too many approval rules
- Bug: List all projects of current user returns empty list
- In CommitManager, using the path filter breaks the endpoint call HOT 3
- Feature: add `pages` support in `project`
- update CI/CD Variables with a specific env
- personal_access_tokens.rotate(<ID>) 'dict' object has no attribute 'token' HOT 3
- get_id() retruns name of label
- project.commits.list(path=some/path.txt) fails because "path" param is used to override path in ListMixin.list HOT 2
- Introduce a global setting to always get all element from `list()` calls HOT 1
- `path` argument of "List repository commits" is overriden
- Feature: Retrieve the job that generated a job token from /job api call
- Cannot update/patch protected branch allowed_to_push/push_access_levels state HOT 1
- How do I differentiate between "405 Method Not Allowed" due to the source branch not being updated or due to conflicts? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-gitlab.