cloudbakers / agm Goto Github PK
View Code? Open in Web Editor NEWAn (unofficial) command line interface for Google APIs
License: Other
An (unofficial) command line interface for Google APIs
License: Other
dont store everything in memory
agm drive files list q "query"
agm drive files list -- user
Unable to parse a JSON string as a parameter as the body. e.g.
agm drive files create -u $me --media_body "$1" --body "{'name': '$1', 'mimeType': 'application/vnd.google-apps.spreadsheet'}"
Using --keyfile doesn't seem to actually use that keyfile. Instead it uses the keyfile in ~/.agm
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/httplib2/init.py", line 1524, in _conn_request
conn.connect()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/httplib2/init.py", line 1305, in connect
sock.connect((self.host, self.port))
socket.gaierror: [Errno 8] nodename nor servname provided, or not known
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/bin/agm", line 10, in
sys.exit(cli())
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/agm/agm.py", line 179, in cli
raise e
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/agm/agm.py", line 166, in cli
run(fully_parsed_args)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/agm/agm.py", line 240, in run
requests, scopes=scopes, keyfile=args.get("keyfile")
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/agm/executor.py", line 147, in multithread_execute_requests
chunk_responses += [future.result()] # Doesnt actually return anything
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/concurrent/futures/_base.py", line 425, in result
return self.__get_result()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result
raise self._exception
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/agm/executor.py", line 160, in execute_requests
keyfile=keyfile,
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/agm/google_auth.py", line 170, in build
service = self.get_service_account_service()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/agm/google_auth.py", line 118, in get_service_account_service
service = self.attempt_authorization(self.keyfile, scope)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/agm/google_auth.py", line 137, in attempt_authorization
service = apiclient.discovery.build(self.name, self.version, http=http)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/googleapiclient/_helpers.py", line 130, in positional_wrapper
return wrapped(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/googleapiclient/discovery.py", line 224, in build
requested_url, discovery_http, cache_discovery, cache, developerKey)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/googleapiclient/discovery.py", line 274, in _retrieve_discovery_doc
resp, content = http.request(actual_url)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/oauth2client/transport.py", line 175, in new_request
redirections, connection_type)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/oauth2client/transport.py", line 282, in request
connection_type=connection_type)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/httplib2/init.py", line 1953, in request
cachekey,
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/httplib2/init.py", line 1618, in _request
conn, request_uri, method, body, headers
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/httplib2/init.py", line 1531, in _conn_request
raise ServerNotFoundError("Unable to find the server at %s" % conn.host)
httplib2.ServerNotFoundError: Unable to find the server at www.googleapis.com
While running the following: agm directory users get [email protected]
With These APIs in scope: https://www.googleapis.com/auth/admin.directory.user
https://www.googleapis.com/auth/admin.directory.user.readonly
I receive this error: Traceback (most recent call last):
File "/home/ktibbs/.local/bin/agm", line 11, in
sys.exit(cli())
File "/home/ktibbs/.local/lib/python3.6/site-packages/agm/agm.py", line 177, in cli
raise e
File "/home/ktibbs/.local/lib/python3.6/site-packages/agm/agm.py", line 165, in cli
run(fully_parsed_args)
File "/home/ktibbs/.local/lib/python3.6/site-packages/agm/agm.py", line 228, in run
list(map(docs.parse_scopes, args.get("scopes") or [])) or method.get_scopes()
File "/home/ktibbs/.local/lib/python3.6/site-packages/agm/docs.py", line 212, in get_scopes
return self.docs.get("scopes")
AttributeError: 'NoneType' object has no attribute 'get'
in docs
Hey,
When running the command: agm directory users list --domain levelup-mail.com
I am receiving: HttpError 403 when requesting https://www.googleapis.com/admin/directory/v1/users?fields=%2A&domain=levelup-mail.com&alt=json returned "Not Authorized to access this resource/api"
also running: agm directory users list
I am receiving: HttpError 400 when requesting https://www.googleapis.com/admin/directory/v1/users?fields=%2A&alt=json returned "Bad Request"
While you can technically import parts of AGM for use in Python code, it's not really built for that and doesn't have a very good interface. Using things like the authenticator helpers and executor class could be useful for others using the Python SDK. I'd want to build out much more thorough testing though.
web browser
for consistency
Unexpected error when running calendar delete command agm calendar events delete --calendarId [calendarId] --eventId [eventId] --user [User]
Error returned:
Unexpected error, please report to https://github.com/Cloudbakers/agm/issues Traceback (most recent call last): File "/home/octavian/.local/bin/agm", line 11, in <module> sys.exit(cli()) File "/home/octavian/.local/lib/python3.6/site-packages/agm/agm.py", line 177, in cli raise e File "/home/octavian/.local/lib/python3.6/site-packages/agm/agm.py", line 165, in cli run(fully_parsed_args) File "/home/octavian/.local/lib/python3.6/site-packages/agm/agm.py", line 238, in run executor.multithread_execute_requests(requests, scopes=scopes) File "/home/octavian/.local/lib/python3.6/site-packages/agm/executor.py", line 140, in multithread_execute_requests chunk_responses += [future.result()] # Doesnt actually return anything File "/usr/lib/python3.6/concurrent/futures/_base.py", line 425, in result return self.__get_result() File "/usr/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result raise self._exception File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run result = self.fn(*self.args, **self.kwargs) File "/home/octavian/.local/lib/python3.6/site-packages/agm/executor.py", line 181, in execute_requests Batch(service, requests_chunk).execute() File "/home/octavian/.local/lib/python3.6/site-packages/agm/executor.py", line 263, in execute return batch.execute() File "/home/octavian/.local/lib/python3.6/site-packages/googleapiclient/_helpers.py", line 130, in positional_wrapper return wrapped(*args, **kwargs) File "/home/octavian/.local/lib/python3.6/site-packages/googleapiclient/http.py", line 1490, in execute self._callback(request_id, response, exception) File "/home/octavian/.local/lib/python3.6/site-packages/agm/executor.py", line 285, in batch_callback request.callback(response) File "/home/octavian/.local/lib/python3.6/site-packages/agm/executor.py", line 113, in json_callback if not output.get("response", {}).get("nextPageToken"): AttributeError: 'str' object has no attribute 'get'
Event is still deleted successfully
^
echo '{"user": "[email protected]"}' | agm drive files list
does not work. says user is null
When running command: agm calendar calendarList list --user [email protected]
I receive error: raceback (most recent call last):
File "/home/ktibbs/.local/bin/agm", line 11, in
sys.exit(cli())
File "/home/ktibbs/.local/lib/python3.6/site-packages/agm/agm.py", line 177, in cli
raise e
File "/home/ktibbs/.local/lib/python3.6/site-packages/agm/agm.py", line 165, in cli
run(fully_parsed_args)
File "/home/ktibbs/.local/lib/python3.6/site-packages/agm/agm.py", line 238, in run
executor.multithread_execute_requests(requests, scopes=scopes)
File "/home/ktibbs/.local/lib/python3.6/site-packages/agm/executor.py", line 140, in multithread_execute_requests
chunk_responses += [future.result()] # Doesnt actually return anything
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 425, in result
return self.__get_result()
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
raise self._exception
File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/ktibbs/.local/lib/python3.6/site-packages/agm/executor.py", line 168, in execute_requests
if paged(service, request):
File "/home/ktibbs/.local/lib/python3.6/site-packages/agm/executor.py", line 198, in paged
resource = _get_resource(service, request.resources)
File "/home/ktibbs/.local/lib/python3.6/site-packages/agm/executor.py", line 241, in _get_resource
resource = getattr(resource, item)()
AttributeError: 'NoneType' object has no attribute 'calendarList
test notifications
If a scope isn't added/defined, a non-descriptive warning is presented which simply states the following:
agm.executor (163) - WARNING: Unable to authenticate user <user email address>
?
Does it work?
I want to be able to use argparse-style flags to send body parameters instead of passing a dictionary to --body
When running command: agm directory users list
Error: Traceback (most recent call last):
File "/home/ktibbs/.local/bin/agm", line 11, in
sys.exit(cli())
File "/home/ktibbs/.local/lib/python3.6/site-packages/agm/agm.py", line 177, in cli
raise e
File "/home/ktibbs/.local/lib/python3.6/site-packages/agm/agm.py", line 165, in cli
run(fully_parsed_args)
File "/home/ktibbs/.local/lib/python3.6/site-packages/agm/agm.py", line 230, in run
requests = get_list_of_requests(fully_parsed_args)
File "/home/ktibbs/.local/lib/python3.6/site-packages/agm/agm.py", line 252, in get_list_of_requests
version = request_cmd.get("version") or docs.get_preferred_version(service)
File "/home/ktibbs/.local/lib/python3.6/site-packages/agm/docs.py", line 61, in get_preferred_version
return versions[0]
IndexError: list index out of range
Have verified that the following API is enabled to utilize this command: https://www.googleapis.com/auth/admin.directory.user
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.