Projects Client

Importing

1
from gradient import ProjectsClient
2
api_key='YOUR_API_KEY'
3
4
projects_client = ProjectsClient(api_key)
Copied!

Creating Projects

1
project_id = projects_client.create('your-project-name')
2
print("project_id: "+project_id)
Copied!
1
project_id: prg8149k1
Copied!
This returns the project ID of the newly created project. Saving this is useful to pass in as input or filter for other queries you make.

Listing Projects

1
projects_list = projects_client.list()
2
for project in project_list:
3
print("project_id: "+project.id +" project_name: "+ project.name)
Copied!
1
project_id: prg8149k1 project_name: 'your-project-name'
Copied!

Projects Object

1
class Project(builtins.object)
2
| Project class
3
|
4
| :param str id:
5
| :param str name:
6
| :param str repository_name:
7
| :param str repository_url:
8
| :param datetime created:
Copied!

Getting Help

If you are ever stuck, you can call help on any ProjectsClient object or function
1
help(ProjectsClient.list)
2
3
Help on function list in module gradient.api_sdk.clients.project_client:
4
5
list(self)
6
Get list of your projects
7
8
*EXAMPLE*::
9
10
gradient projects list
11
12
*EXAMPLE RETURN*::
13
14
+-----------+------------------+------------+----------------------------+
15
| ID | Name | Repository | Created |
16
+-----------+------------------+------------+----------------------------+
17
| project-id| <name-of-project>| None | 2019-06-28 10:38:57.874000 |
18
| project-id| <name-of-project>| None | 2019-07-17 13:17:34.493000 |
19
| project-id| <name-of-project>| None | 2019-07-17 13:21:12.770000 |
20
| project-id| <name-of-project>| None | 2019-07-29 09:26:49.105000 |
21
+-----------+------------------+------------+----------------------------+
22
23
in sdk::
24
25
from gradient.api_sdk.clients import ProjectsClient
26
27
api_key = 'your-api-key'
28
projects_client = ProjectsClient(api_key)
29
30
projects_list = projects_client.list()
31
32
for project in project_list:
33
print(project)
Copied!
Last modified 3mo ago