Add a new `rbt api` command and support `--get`, `--put`, `--post` and `--delete` options.

Review Request #11479 — Created Feb. 21, 2021 and updated

Information

RBTools
master

Reviewers

The reason why we need api command instead of api-get is simple: We need to do HTTP GET, POST, PUT, DELETE requests.
I created api command, with new options --get, --post, --put, --delete, --patch, --file="local path", --data='key1=value1', --header='headercontent' , original --pretty option and server options still work.

For api --get, --post, --put, --delete options, I did some testings using command line tools.

I created a review request draft and used my --get, --post, --put and --delete options, they all worked fine.
I posted several files to the review request draft using --post and --file options and they worked.
I don't think our reviewboard APIs support --patch at this moment so I just left it there in case one day it will be useful.

Summary ID
Merge XDG project changes in local branch into local master
13e4b1d3a98ebb31a701b4c80c457da035d050c0
[WIP]Add a new command called "api". Add option commands called "--get", "--post", "--delete". "api --get" option can substitute original "api-get" option now.
f5d08321dbf89a392a282e30b1cc4eba4f0d406e
[WIP]Add api.py file, forget to stage this file in the last commit.
39de827276ea422dea3fc1f630d35c17f415ab9c
[WIP]Add "--put" option but still need to find out how to send post/put data. Add "--header" option, still need to find a way to combine our customized header with original data.
9300eb1518e3b078f03aeb388b7f91821e915c7f
Refactor methods in api class. Now support use --header option to add customized header in a request.
604bed2b22deb3145dcf7339753bd2096d9d8889
[WIP]Allow basic HTTP GET, DELETE. Allow POST and PUT key value pairs. Still need further testings
f12ccfbf6346c75a934fdf6e70ee37c6e5c38702
Remove redundant print statements from api-get.py
dc104eaacfc259f3466e0c0cf14982ccc21da57e
Fix coding style problems.
dc4fcf3ccc29f5d6ab8243ade250c9ff830730e9
Fix more coding style problems.
027ac7cc1ef765176d3c8a98c8fa09e9295a4378
Add a newline character.
3058676f474918449c806faea1fe1787e168e659
Change create create_cookie_jar function. Edit test_create_cookie_jar. Fix coding style problems. Change improper variable names.
44efa2f7a4d647cba179c40223fa31685614cd15
Api testing
e5c49dad1d97276dbe9e4a21edb136e7984ee54e
Test "--post" and "--put" options.
53939217e08588c88d4a410bab2b4337e8ebcfd8
Revert "Change create create_cookie_jar function. Edit test_create_cookie_jar. Fix coding style problems. Change improper variable names."
This reverts commit 44efa2f7a4d647cba179c40223fa31685614cd15.
5068e0c14b5c564f8917f221100b9b6fc084f563
Revert "Merge XDG project changes in local branch into local master"
This reverts commit 13e4b1d3a98ebb31a701b4c80c457da035d050c0.
d3baaf085443b05301478c034acc24631dfedd2b
Fix coding style problems.
921d578ffcec441f0047bc4f4c4fc8cd3c74673c
Add "--patch" and "--file" options. Finish testing "--post", "--put", "--get", "--delete", "--pretty" and "--header" options.
e5529638e506d696280d0f28377f017729fe53a3
Fix coding style problems.
41fca77f0fcf26e86c9cef616e2e9ab8ce7dd371
Fix file upload problem.
8b092c2d0797f6f2f367d0a27d163dff221f0076
Fix redundant variable problem.
122e4a928f1513907dd14ca73289f08f33066f24
Fix coding style problems. Add method docs. Add method helpers.
ca8f74f465f3ac16e3909f626ea649e3b8efd9b3
Fix coding style problems.
232ae21dc68075b4259ced72f86563e006f007cd
Remove .DS_Store file.
83d5cbb5a8c9b8c0bba6a2dfaa3660afb84a4abd
Add __future__ module doc string.
187b2ab7edcefd834a8c8da1cf62e03704c1605b
Refactor code. Fix improper usage of variables.
aa3ebd0cc4f78e6fb887d7d7aedc30ab1e5b464f
Fix coding style problems.
dc68ac243b80d790d14d519b582e161fe371f941
Fix coding style problems.
b8a14bb190c4e8f99bb37d71eaa8a2161149c501
Fix trailing space problems.
5b9e1d3306d68e41892698b96c063439efaa9c49
Description From Last Updated

Please remove the .DS_Store file from your change.

daviddavid

E225 missing whitespace around operator

reviewbotreviewbot

W293 blank line contains whitespace

reviewbotreviewbot

W293 blank line contains whitespace

reviewbotreviewbot

W293 blank line contains whitespace

reviewbotreviewbot

W293 blank line contains whitespace

reviewbotreviewbot

W291 trailing whitespace

reviewbotreviewbot

W291 trailing whitespace

reviewbotreviewbot

W291 trailing whitespace

reviewbotreviewbot

W293 blank line contains whitespace

reviewbotreviewbot

W293 blank line contains whitespace

reviewbotreviewbot

F401 'rbtools.commands.OptionGroup' imported but unused

reviewbotreviewbot

E302 expected 2 blank lines, found 1

reviewbotreviewbot

E128 continuation line under-indented for visual indent

reviewbotreviewbot

W503 line break before binary operator

reviewbotreviewbot

W291 trailing whitespace

reviewbotreviewbot

W291 trailing whitespace

reviewbotreviewbot

E128 continuation line under-indented for visual indent

reviewbotreviewbot

W503 line break before binary operator

reviewbotreviewbot

E303 too many blank lines (2)

reviewbotreviewbot

E231 missing whitespace after ':'

reviewbotreviewbot

W291 trailing whitespace

reviewbotreviewbot

W293 blank line contains whitespace

reviewbotreviewbot

W391 blank line at end of file

reviewbotreviewbot

W293 blank line contains whitespace

reviewbotreviewbot

W291 trailing whitespace

reviewbotreviewbot

W291 trailing whitespace

reviewbotreviewbot

W291 trailing whitespace

reviewbotreviewbot

W293 blank line contains whitespace

reviewbotreviewbot

W293 blank line contains whitespace

reviewbotreviewbot

W391 blank line at end of file

reviewbotreviewbot

W293 blank line contains whitespace

reviewbotreviewbot

W292 no newline at end of file

reviewbotreviewbot

F841 local variable 'e' is assigned to but never used

reviewbotreviewbot

E231 missing whitespace after ','

reviewbotreviewbot

W293 blank line contains whitespace

reviewbotreviewbot

E265 block comment should start with '# '

reviewbotreviewbot

W291 trailing whitespace

reviewbotreviewbot

W291 trailing whitespace

reviewbotreviewbot

E228 missing whitespace around modulo operator

reviewbotreviewbot

F841 local variable 'e' is assigned to but never used

reviewbotreviewbot

E265 block comment should start with '# '

reviewbotreviewbot

W291 trailing whitespace

reviewbotreviewbot

E231 missing whitespace after ':'

reviewbotreviewbot

E231 missing whitespace after ':'

reviewbotreviewbot

E231 missing whitespace after ':'

reviewbotreviewbot

E501 line too long (82 > 79 characters)

reviewbotreviewbot

E303 too many blank lines (2)

reviewbotreviewbot

F841 local variable 'name' is assigned to but never used

reviewbotreviewbot

This should be reverted.

daviddavid

Please restore this blank line.

daviddavid

This needs a method docstring.

daviddavid

This should probably be defined as a raw string (prefix with r, like `r'(...)+')

daviddavid

Should this be KeyError instead of just Exception?

daviddavid

Should this be using the data variable you just defined?

daviddavid

This needs a method docstring.

daviddavid

Please use single quotes instead of double.

daviddavid

This needs a method docstring.

daviddavid

Blank line between these two

daviddavid

This needs a method docstring.

daviddavid

This needs a method docstring.

daviddavid

Should this be KeyError?

daviddavid

We're doing this a lot. Perhaps we can have a helper method to sanitize the URL?

daviddavid

Please use single quotes instead of double.

daviddavid

This needs a method docstring.

daviddavid

This needs a method docstring.

daviddavid

Please use single quotes instead of double.

daviddavid

This needs a method docstring.

daviddavid

This needs a method docstring.

daviddavid

Might be nice to have a helper for this too.

daviddavid

Please use single quotes instead of double.

daviddavid

This needs a method docstring.

daviddavid

KeyError?

daviddavid

Please use single quotes instead of double.

daviddavid

This needs a method docstring.

daviddavid

This needs a method docstring.

daviddavid

Please revert these changes--it's just churn in blank lines for no purpose.

daviddavid

Same here--move the blank line back, please.

daviddavid

Please revert the changes in this file.

daviddavid

This needs a module docstring.

daviddavid

This needs a class docstring.

daviddavid

How about "Perform Review Board API requests"? Note also that when we wrap a string, we put the space at …

daviddavid

Put the space at the end of the first line instead of beginning of the second.

daviddavid

Please swap the use of single and double quotes here.

daviddavid

Swap single and double quotes here.

daviddavid

This needs a method docstring.

daviddavid

This first part needs to fit on a single line. Simply "Handle HTTP requests" is probably sufficient--the arguments are listed …

daviddavid

This should probably mention that it prints output. Alternatively, this method could just return the request and the caller could …

daviddavid

There's an extra blank line here.

daviddavid

This blank line can be removed.

daviddavid

Please use single quotes.

daviddavid

Please use single quotes.

daviddavid

Please use single quotes.

daviddavid

Please use single quotes. This should also wrap with each entry on its own line. We could even avoid defining …

daviddavid

This needs a docstring.

daviddavid

Add a blank line between these two.

daviddavid

This should probably print an error (probably different errors depending on if no method was passed, or if multiple methods …

daviddavid

This should be reverted.

daviddavid

Please revert the changes to this file.

daviddavid

Please revert the changes to this file.

daviddavid

E501 line too long (80 > 79 characters)

reviewbotreviewbot

W291 trailing whitespace

reviewbotreviewbot

W291 trailing whitespace

reviewbotreviewbot

This isn't ultimately useful to have here in our codebase. It's a great thing to learn! But these imports are …

chipx86chipx86

Can you rename this to _get_padded_url? That's a better fit for the naming we aim for. We want to communicate …

chipx86chipx86

Likewise, this would be better as "Returns a URL ending with a slash." ("URL" should always be capitalized.)

chipx86chipx86

For "Returns", the description text can't be indented. We do indent for "Args," because we're have a list of arguments. …

chipx86chipx86

"The URL or path ending with a '/'." would be better.

chipx86chipx86

We can probably simplify this: if not url.ensdwith('/'): url = '%s/' % url return url Avoids the creation of a …

chipx86chipx86

You can probably replace this with Python's urljoin function.

chipx86chipx86

No indentation for descriptions in "Returns". This will apply to any others throughout this change.

chipx86chipx86

Is this for querystrings? If so, check out Python's parse_qsl function. Look at HttpRequest in RBTools for code already doing …

chipx86chipx86

The naming may seem unrelated, but this is actually already available to us in Python's email module as email.message_from_string. This …

chipx86chipx86

Should always be capitalized as "URL". Same elsewhere in the change.

chipx86chipx86

Repeating ourselves for each method can end up increasing our maintenance burden. Instead, since these are all wrapping a centralized …

chipx86chipx86

Instead of dict.items(), we need to do six.iteritems(dict) to get consistent behavior across Python 2 and 3. Same anywhere else …

chipx86chipx86

All these _path versions of these functions seem to have the same logic as the _url versions, but are creating …

chipx86chipx86

All these blank lines need to remain.

chipx86chipx86

This should be removed, for the same reason above.

chipx86chipx86

rbt api --post Other examples are also missing the api bit.

chipx86chipx86

I think we shouldn't say too much more than "Send a HTTP PATCH request to an API" (and same for …

chipx86chipx86

All private functions should follow public functions.

chipx86chipx86

You probably want a blank line here.

chipx86chipx86

self.options.pretty_print is a reference to internal code. Write these docs like nobody's reading your code. You probably want to say …

chipx86chipx86

This is missing a return type. We're also not streaming to anything. We're just returning a string.

chipx86chipx86

Comma should be on the prior line.

chipx86chipx86

"JSON"

chipx86chipx86

You want a blank line before the statement and the loop, but not on the first inner line of the …

chipx86chipx86

This can be simplified massively by doing a couple things: Have each HTTP method option (--get, --post, etc.) have an …

chipx86chipx86

startswith takes a tuple, for convenience: if path.startswith(('http://', 'https://')):

chipx86chipx86

This will need to be the full import class path.

chipx86chipx86

I think we want to avoid allowing anything unexpected to be a query argument. What if an API takes a …

chipx86chipx86

The above recommendation about the HTTP method options will eliminate all of this. Now, that doesn't mean that it'll duplicate …

chipx86chipx86

F401 'email' imported but unused

reviewbotreviewbot

F401 're' imported but unused

reviewbotreviewbot

F401 'urllib.parse.urljoin' imported but unused

reviewbotreviewbot

W291 trailing whitespace

reviewbotreviewbot

F841 local variable 'body_dict' is assigned to but never used

reviewbotreviewbot

F841 local variable 'file_path_list' is assigned to but never used

reviewbotreviewbot

W293 blank line contains whitespace

reviewbotreviewbot

W291 trailing whitespace

reviewbotreviewbot

F841 local variable 'file_path_list' is assigned to but never used

reviewbotreviewbot

F841 local variable 'file_path_list' is assigned to but never used

reviewbotreviewbot

F841 local variable 'body_dict' is assigned to but never used

reviewbotreviewbot

F841 local variable 'file_path_list' is assigned to but never used

reviewbotreviewbot

F401 'argparse' imported but unused

reviewbotreviewbot

F401 'rbtools.commands.ParseError' imported but unused

reviewbotreviewbot

F841 local variable 'query_dict' is assigned to but never used

reviewbotreviewbot

E501 line too long (80 > 79 characters)

reviewbotreviewbot

W293 blank line contains whitespace

reviewbotreviewbot

F841 local variable 'query_arguments' is assigned to but never used

reviewbotreviewbot

E501 line too long (82 > 79 characters)

reviewbotreviewbot

E501 line too long (80 > 79 characters)

reviewbotreviewbot

E501 line too long (80 > 79 characters)

reviewbotreviewbot

E501 line too long (80 > 79 characters)

reviewbotreviewbot

W291 trailing whitespace

reviewbotreviewbot

W291 trailing whitespace

reviewbotreviewbot

W291 trailing whitespace

reviewbotreviewbot
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

qianxi
Review request changed

Change Summary:

Fix coding style problems

Commits:

Summary ID
Merge XDG project changes in local branch into local master
13e4b1d3a98ebb31a701b4c80c457da035d050c0
[WIP]Add a new command called "api". Add option commands called "--get", "--post", "--delete". "api --get" option can substitute original "api-get" option now.
f5d08321dbf89a392a282e30b1cc4eba4f0d406e
[WIP]Add api.py file, forget to stage this file in the last commit.
39de827276ea422dea3fc1f630d35c17f415ab9c
[WIP]Add "--put" option but still need to find out how to send post/put data. Add "--header" option, still need to find a way to combine our customized header with original data.
9300eb1518e3b078f03aeb388b7f91821e915c7f
Refactor methods in api class. Now support use --header option to add customized header in a request.
604bed2b22deb3145dcf7339753bd2096d9d8889
[WIP]Allow basic HTTP GET, DELETE. Allow POST and PUT key value pairs. Still need further testings
f12ccfbf6346c75a934fdf6e70ee37c6e5c38702
Remove redundant print statements from api-get.py
dc104eaacfc259f3466e0c0cf14982ccc21da57e
Merge XDG project changes in local branch into local master
13e4b1d3a98ebb31a701b4c80c457da035d050c0
[WIP]Add a new command called "api". Add option commands called "--get", "--post", "--delete". "api --get" option can substitute original "api-get" option now.
f5d08321dbf89a392a282e30b1cc4eba4f0d406e
[WIP]Add api.py file, forget to stage this file in the last commit.
39de827276ea422dea3fc1f630d35c17f415ab9c
[WIP]Add "--put" option but still need to find out how to send post/put data. Add "--header" option, still need to find a way to combine our customized header with original data.
9300eb1518e3b078f03aeb388b7f91821e915c7f
Refactor methods in api class. Now support use --header option to add customized header in a request.
604bed2b22deb3145dcf7339753bd2096d9d8889
[WIP]Allow basic HTTP GET, DELETE. Allow POST and PUT key value pairs. Still need further testings
f12ccfbf6346c75a934fdf6e70ee37c6e5c38702
Remove redundant print statements from api-get.py
dc104eaacfc259f3466e0c0cf14982ccc21da57e
Fix coding style problems.
dc4fcf3ccc29f5d6ab8243ade250c9ff830730e9

Diff:

Revision 2 (+1120 -218)

Show changes

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

qianxi
Review request changed

Change Summary:

Fix more coding style problems.

Commits:

Summary ID
Merge XDG project changes in local branch into local master
13e4b1d3a98ebb31a701b4c80c457da035d050c0
[WIP]Add a new command called "api". Add option commands called "--get", "--post", "--delete". "api --get" option can substitute original "api-get" option now.
f5d08321dbf89a392a282e30b1cc4eba4f0d406e
[WIP]Add api.py file, forget to stage this file in the last commit.
39de827276ea422dea3fc1f630d35c17f415ab9c
[WIP]Add "--put" option but still need to find out how to send post/put data. Add "--header" option, still need to find a way to combine our customized header with original data.
9300eb1518e3b078f03aeb388b7f91821e915c7f
Refactor methods in api class. Now support use --header option to add customized header in a request.
604bed2b22deb3145dcf7339753bd2096d9d8889
[WIP]Allow basic HTTP GET, DELETE. Allow POST and PUT key value pairs. Still need further testings
f12ccfbf6346c75a934fdf6e70ee37c6e5c38702
Remove redundant print statements from api-get.py
dc104eaacfc259f3466e0c0cf14982ccc21da57e
Fix coding style problems.
dc4fcf3ccc29f5d6ab8243ade250c9ff830730e9
Merge XDG project changes in local branch into local master
13e4b1d3a98ebb31a701b4c80c457da035d050c0
[WIP]Add a new command called "api". Add option commands called "--get", "--post", "--delete". "api --get" option can substitute original "api-get" option now.
f5d08321dbf89a392a282e30b1cc4eba4f0d406e
[WIP]Add api.py file, forget to stage this file in the last commit.
39de827276ea422dea3fc1f630d35c17f415ab9c
[WIP]Add "--put" option but still need to find out how to send post/put data. Add "--header" option, still need to find a way to combine our customized header with original data.
9300eb1518e3b078f03aeb388b7f91821e915c7f
Refactor methods in api class. Now support use --header option to add customized header in a request.
604bed2b22deb3145dcf7339753bd2096d9d8889
[WIP]Allow basic HTTP GET, DELETE. Allow POST and PUT key value pairs. Still need further testings
f12ccfbf6346c75a934fdf6e70ee37c6e5c38702
Remove redundant print statements from api-get.py
dc104eaacfc259f3466e0c0cf14982ccc21da57e
Fix coding style problems.
dc4fcf3ccc29f5d6ab8243ade250c9ff830730e9
Fix more coding style problems.
027ac7cc1ef765176d3c8a98c8fa09e9295a4378

Diff:

Revision 3 (+1124 -226)

Show changes

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

qianxi
qianxi
Review request changed

Change Summary:

Revert commits from another project.

Summary:

-Add `api` command and options like `--get`, `--post`, `--put`, `--delete`, `--data=key1=value1` and `--header=headercontent`
+Add a new `rbt api` command and support `--get`, `--put`, `--post` and `--delete` options.

Description:

   

The reason why we need api command instead of api-get is simple: We need to do HTTP GET, POST, PUT, DELETE requests.

~   I created api command, with new options --get, --post, --put, --delete, --data=key1=value1, --header=headercontent , original --pretty option and server options still work.
  ~ I created api command, with new options --get, --post, --put, --delete, --data='key1=value1', --header='headercontent' , original --pretty option and server options still work.

-   I'll add support for file data POST and PUT later.
-   Please omit "Merge XDG project changes in local branch into local master" commit, I believe the commit content should be the same as https://reviews.reviewboard.org/r/11423/.

Testing Done:

~  

For api --get, --post, --put, --delete options, I did some basic testings using command line tools. They all work for non-existed urls and --get works for existing api resources. We can use --data=key1=value1 to add post data and use --header=headercontent to add customized headers. And --pretty option still works. I will do further testing later.

  ~

For api --get, --post, --put, --delete options, I did some testings using command line tools.

  +
  +

I created a review request draft and used my --get, --post, --put and --delete options, they all worked fine.

Commits:

Summary ID
Merge XDG project changes in local branch into local master
13e4b1d3a98ebb31a701b4c80c457da035d050c0
[WIP]Add a new command called "api". Add option commands called "--get", "--post", "--delete". "api --get" option can substitute original "api-get" option now.
f5d08321dbf89a392a282e30b1cc4eba4f0d406e
[WIP]Add api.py file, forget to stage this file in the last commit.
39de827276ea422dea3fc1f630d35c17f415ab9c
[WIP]Add "--put" option but still need to find out how to send post/put data. Add "--header" option, still need to find a way to combine our customized header with original data.
9300eb1518e3b078f03aeb388b7f91821e915c7f
Refactor methods in api class. Now support use --header option to add customized header in a request.
604bed2b22deb3145dcf7339753bd2096d9d8889
[WIP]Allow basic HTTP GET, DELETE. Allow POST and PUT key value pairs. Still need further testings
f12ccfbf6346c75a934fdf6e70ee37c6e5c38702
Remove redundant print statements from api-get.py
dc104eaacfc259f3466e0c0cf14982ccc21da57e
Fix coding style problems.
dc4fcf3ccc29f5d6ab8243ade250c9ff830730e9
Fix more coding style problems.
027ac7cc1ef765176d3c8a98c8fa09e9295a4378
Add a newline character.
3058676f474918449c806faea1fe1787e168e659
Merge XDG project changes in local branch into local master
13e4b1d3a98ebb31a701b4c80c457da035d050c0
[WIP]Add a new command called "api". Add option commands called "--get", "--post", "--delete". "api --get" option can substitute original "api-get" option now.
f5d08321dbf89a392a282e30b1cc4eba4f0d406e
[WIP]Add api.py file, forget to stage this file in the last commit.
39de827276ea422dea3fc1f630d35c17f415ab9c
[WIP]Add "--put" option but still need to find out how to send post/put data. Add "--header" option, still need to find a way to combine our customized header with original data.
9300eb1518e3b078f03aeb388b7f91821e915c7f
Refactor methods in api class. Now support use --header option to add customized header in a request.
604bed2b22deb3145dcf7339753bd2096d9d8889
[WIP]Allow basic HTTP GET, DELETE. Allow POST and PUT key value pairs. Still need further testings
f12ccfbf6346c75a934fdf6e70ee37c6e5c38702
Remove redundant print statements from api-get.py
dc104eaacfc259f3466e0c0cf14982ccc21da57e
Fix coding style problems.
dc4fcf3ccc29f5d6ab8243ade250c9ff830730e9
Fix more coding style problems.
027ac7cc1ef765176d3c8a98c8fa09e9295a4378
Add a newline character.
3058676f474918449c806faea1fe1787e168e659
Change create create_cookie_jar function. Edit test_create_cookie_jar. Fix coding style problems. Change improper variable names.
44efa2f7a4d647cba179c40223fa31685614cd15
Api testing
e5c49dad1d97276dbe9e4a21edb136e7984ee54e
Test "--post" and "--put" options.
53939217e08588c88d4a410bab2b4337e8ebcfd8
Revert "Change create create_cookie_jar function. Edit test_create_cookie_jar. Fix coding style problems. Change improper variable names."
This reverts commit 44efa2f7a4d647cba179c40223fa31685614cd15.
5068e0c14b5c564f8917f221100b9b6fc084f563
Revert "Merge XDG project changes in local branch into local master"
This reverts commit 13e4b1d3a98ebb31a701b4c80c457da035d050c0.
d3baaf085443b05301478c034acc24631dfedd2b

Diff:

Revision 5 (+1385 -617)

Show changes

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

qianxi
qianxi
Review request changed

Description:

   

The reason why we need api command instead of api-get is simple: We need to do HTTP GET, POST, PUT, DELETE requests.

~   I created api command, with new options --get, --post, --put, --delete, --data='key1=value1', --header='headercontent' , original --pretty option and server options still work.

  ~ I created api command, with new options --get, --post, --put, --delete, --patch, --file="local path", --data='key1=value1', --header='headercontent' , original --pretty option and server options still work.

Testing Done:

   

For api --get, --post, --put, --delete options, I did some testings using command line tools.

   
~  

I created a review request draft and used my --get, --post, --put and --delete options, they all worked fine.

  ~

I created a review request draft and used my --get, --post, --put and --delete options, they all worked fine.

  + I don't think our reviewboard APIs support --patch so I just left it there in case one day it will be useful.

Commits:

Summary ID
Merge XDG project changes in local branch into local master
13e4b1d3a98ebb31a701b4c80c457da035d050c0
[WIP]Add a new command called "api". Add option commands called "--get", "--post", "--delete". "api --get" option can substitute original "api-get" option now.
f5d08321dbf89a392a282e30b1cc4eba4f0d406e
[WIP]Add api.py file, forget to stage this file in the last commit.
39de827276ea422dea3fc1f630d35c17f415ab9c
[WIP]Add "--put" option but still need to find out how to send post/put data. Add "--header" option, still need to find a way to combine our customized header with original data.
9300eb1518e3b078f03aeb388b7f91821e915c7f
Refactor methods in api class. Now support use --header option to add customized header in a request.
604bed2b22deb3145dcf7339753bd2096d9d8889
[WIP]Allow basic HTTP GET, DELETE. Allow POST and PUT key value pairs. Still need further testings
f12ccfbf6346c75a934fdf6e70ee37c6e5c38702
Remove redundant print statements from api-get.py
dc104eaacfc259f3466e0c0cf14982ccc21da57e
Fix coding style problems.
dc4fcf3ccc29f5d6ab8243ade250c9ff830730e9
Fix more coding style problems.
027ac7cc1ef765176d3c8a98c8fa09e9295a4378
Add a newline character.
3058676f474918449c806faea1fe1787e168e659
Change create create_cookie_jar function. Edit test_create_cookie_jar. Fix coding style problems. Change improper variable names.
44efa2f7a4d647cba179c40223fa31685614cd15
Api testing
e5c49dad1d97276dbe9e4a21edb136e7984ee54e
Test "--post" and "--put" options.
53939217e08588c88d4a410bab2b4337e8ebcfd8
Revert "Change create create_cookie_jar function. Edit test_create_cookie_jar. Fix coding style problems. Change improper variable names."
This reverts commit 44efa2f7a4d647cba179c40223fa31685614cd15.
5068e0c14b5c564f8917f221100b9b6fc084f563
Revert "Merge XDG project changes in local branch into local master"
This reverts commit 13e4b1d3a98ebb31a701b4c80c457da035d050c0.
d3baaf085443b05301478c034acc24631dfedd2b
Fix coding style problems.
921d578ffcec441f0047bc4f4c4fc8cd3c74673c
Merge XDG project changes in local branch into local master
13e4b1d3a98ebb31a701b4c80c457da035d050c0
[WIP]Add a new command called "api". Add option commands called "--get", "--post", "--delete". "api --get" option can substitute original "api-get" option now.
f5d08321dbf89a392a282e30b1cc4eba4f0d406e
[WIP]Add api.py file, forget to stage this file in the last commit.
39de827276ea422dea3fc1f630d35c17f415ab9c
[WIP]Add "--put" option but still need to find out how to send post/put data. Add "--header" option, still need to find a way to combine our customized header with original data.
9300eb1518e3b078f03aeb388b7f91821e915c7f
Refactor methods in api class. Now support use --header option to add customized header in a request.
604bed2b22deb3145dcf7339753bd2096d9d8889
[WIP]Allow basic HTTP GET, DELETE. Allow POST and PUT key value pairs. Still need further testings
f12ccfbf6346c75a934fdf6e70ee37c6e5c38702
Remove redundant print statements from api-get.py
dc104eaacfc259f3466e0c0cf14982ccc21da57e
Fix coding style problems.
dc4fcf3ccc29f5d6ab8243ade250c9ff830730e9
Fix more coding style problems.
027ac7cc1ef765176d3c8a98c8fa09e9295a4378
Add a newline character.
3058676f474918449c806faea1fe1787e168e659
Change create create_cookie_jar function. Edit test_create_cookie_jar. Fix coding style problems. Change improper variable names.
44efa2f7a4d647cba179c40223fa31685614cd15
Api testing
e5c49dad1d97276dbe9e4a21edb136e7984ee54e
Test "--post" and "--put" options.
53939217e08588c88d4a410bab2b4337e8ebcfd8
Revert "Change create create_cookie_jar function. Edit test_create_cookie_jar. Fix coding style problems. Change improper variable names."
This reverts commit 44efa2f7a4d647cba179c40223fa31685614cd15.
5068e0c14b5c564f8917f221100b9b6fc084f563
Revert "Merge XDG project changes in local branch into local master"
This reverts commit 13e4b1d3a98ebb31a701b4c80c457da035d050c0.
d3baaf085443b05301478c034acc24631dfedd2b
Fix coding style problems.
921d578ffcec441f0047bc4f4c4fc8cd3c74673c
Add "--patch" and "--file" options. Finish testing "--post", "--put", "--get", "--delete", "--pretty" and "--header" options.
e5529638e506d696280d0f28377f017729fe53a3

Diff:

Revision 7 (+1570 -632)

Show changes

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

qianxi
qianxi
Review request changed

Testing Done:

   

For api --get, --post, --put, --delete options, I did some testings using command line tools.

   
   

I created a review request draft and used my --get, --post, --put and --delete options, they all worked fine.

~   I don't think our reviewboard APIs support --patch so I just left it there in case one day it will be useful.

  ~ I posted several files to the review request draft using --post and --file options and they worked.
  + I don't think our reviewboard APIs support --patch at this moment so I just left it there in case one day it will be useful.

Commits:

Summary ID
Merge XDG project changes in local branch into local master
13e4b1d3a98ebb31a701b4c80c457da035d050c0
[WIP]Add a new command called "api". Add option commands called "--get", "--post", "--delete". "api --get" option can substitute original "api-get" option now.
f5d08321dbf89a392a282e30b1cc4eba4f0d406e
[WIP]Add api.py file, forget to stage this file in the last commit.
39de827276ea422dea3fc1f630d35c17f415ab9c
[WIP]Add "--put" option but still need to find out how to send post/put data. Add "--header" option, still need to find a way to combine our customized header with original data.
9300eb1518e3b078f03aeb388b7f91821e915c7f
Refactor methods in api class. Now support use --header option to add customized header in a request.
604bed2b22deb3145dcf7339753bd2096d9d8889
[WIP]Allow basic HTTP GET, DELETE. Allow POST and PUT key value pairs. Still need further testings
f12ccfbf6346c75a934fdf6e70ee37c6e5c38702
Remove redundant print statements from api-get.py
dc104eaacfc259f3466e0c0cf14982ccc21da57e
Fix coding style problems.
dc4fcf3ccc29f5d6ab8243ade250c9ff830730e9
Fix more coding style problems.
027ac7cc1ef765176d3c8a98c8fa09e9295a4378
Add a newline character.
3058676f474918449c806faea1fe1787e168e659
Change create create_cookie_jar function. Edit test_create_cookie_jar. Fix coding style problems. Change improper variable names.
44efa2f7a4d647cba179c40223fa31685614cd15
Api testing
e5c49dad1d97276dbe9e4a21edb136e7984ee54e
Test "--post" and "--put" options.
53939217e08588c88d4a410bab2b4337e8ebcfd8
Revert "Change create create_cookie_jar function. Edit test_create_cookie_jar. Fix coding style problems. Change improper variable names."
This reverts commit 44efa2f7a4d647cba179c40223fa31685614cd15.
5068e0c14b5c564f8917f221100b9b6fc084f563
Revert "Merge XDG project changes in local branch into local master"
This reverts commit 13e4b1d3a98ebb31a701b4c80c457da035d050c0.
d3baaf085443b05301478c034acc24631dfedd2b
Fix coding style problems.
921d578ffcec441f0047bc4f4c4fc8cd3c74673c
Add "--patch" and "--file" options. Finish testing "--post", "--put", "--get", "--delete", "--pretty" and "--header" options.
e5529638e506d696280d0f28377f017729fe53a3
Fix coding style problems.
41fca77f0fcf26e86c9cef616e2e9ab8ce7dd371
Merge XDG project changes in local branch into local master
13e4b1d3a98ebb31a701b4c80c457da035d050c0
[WIP]Add a new command called "api". Add option commands called "--get", "--post", "--delete". "api --get" option can substitute original "api-get" option now.
f5d08321dbf89a392a282e30b1cc4eba4f0d406e
[WIP]Add api.py file, forget to stage this file in the last commit.
39de827276ea422dea3fc1f630d35c17f415ab9c
[WIP]Add "--put" option but still need to find out how to send post/put data. Add "--header" option, still need to find a way to combine our customized header with original data.
9300eb1518e3b078f03aeb388b7f91821e915c7f
Refactor methods in api class. Now support use --header option to add customized header in a request.
604bed2b22deb3145dcf7339753bd2096d9d8889
[WIP]Allow basic HTTP GET, DELETE. Allow POST and PUT key value pairs. Still need further testings
f12ccfbf6346c75a934fdf6e70ee37c6e5c38702
Remove redundant print statements from api-get.py
dc104eaacfc259f3466e0c0cf14982ccc21da57e
Fix coding style problems.
dc4fcf3ccc29f5d6ab8243ade250c9ff830730e9
Fix more coding style problems.
027ac7cc1ef765176d3c8a98c8fa09e9295a4378
Add a newline character.
3058676f474918449c806faea1fe1787e168e659
Change create create_cookie_jar function. Edit test_create_cookie_jar. Fix coding style problems. Change improper variable names.
44efa2f7a4d647cba179c40223fa31685614cd15
Api testing
e5c49dad1d97276dbe9e4a21edb136e7984ee54e
Test "--post" and "--put" options.
53939217e08588c88d4a410bab2b4337e8ebcfd8
Revert "Change create create_cookie_jar function. Edit test_create_cookie_jar. Fix coding style problems. Change improper variable names."
This reverts commit 44efa2f7a4d647cba179c40223fa31685614cd15.
5068e0c14b5c564f8917f221100b9b6fc084f563
Revert "Merge XDG project changes in local branch into local master"
This reverts commit 13e4b1d3a98ebb31a701b4c80c457da035d050c0.
d3baaf085443b05301478c034acc24631dfedd2b
Fix coding style problems.
921d578ffcec441f0047bc4f4c4fc8cd3c74673c
Add "--patch" and "--file" options. Finish testing "--post", "--put", "--get", "--delete", "--pretty" and "--header" options.
e5529638e506d696280d0f28377f017729fe53a3
Fix coding style problems.
41fca77f0fcf26e86c9cef616e2e9ab8ce7dd371
Fix file upload problem.
8b092c2d0797f6f2f367d0a27d163dff221f0076

Diff:

Revision 9 (+1593 -647)

Show changes

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

qianxi
david
  1. 
      
  2. Please remove the .DS_Store file from your change.

  3. contrib/tools/git-hook-check-approval (Diff revision 10)
     
     

    This should be reverted.

  4. rbtools/api/factory.py (Diff revision 10)
     
     

    Please restore this blank line.

  5. rbtools/api/transport/sync.py (Diff revision 10)
     
     

    This needs a method docstring.

  6. rbtools/api/transport/sync.py (Diff revision 10)
     
     

    This should probably be defined as a raw string (prefix with r, like `r'(...)+')

  7. rbtools/api/transport/sync.py (Diff revision 10)
     
     

    Should this be KeyError instead of just Exception?

  8. rbtools/api/transport/sync.py (Diff revision 10)
     
     

    Should this be using the data variable you just defined?

  9. rbtools/api/transport/sync.py (Diff revision 10)
     
     

    This needs a method docstring.

  10. rbtools/api/transport/sync.py (Diff revision 10)
     
     

    Please use single quotes instead of double.

  11. rbtools/api/transport/sync.py (Diff revision 10)
     
     

    This needs a method docstring.

  12. rbtools/api/transport/sync.py (Diff revision 10)
     
     
     

    Blank line between these two

  13. rbtools/api/transport/sync.py (Diff revision 10)
     
     

    This needs a method docstring.

  14. rbtools/api/transport/sync.py (Diff revision 10)
     
     

    This needs a method docstring.

  15. rbtools/api/transport/sync.py (Diff revision 10)
     
     

    Should this be KeyError?

  16. rbtools/api/transport/sync.py (Diff revision 10)
     
     
     

    We're doing this a lot. Perhaps we can have a helper method to sanitize the URL?

  17. rbtools/api/transport/sync.py (Diff revision 10)
     
     

    Please use single quotes instead of double.

  18. rbtools/api/transport/sync.py (Diff revision 10)
     
     

    This needs a method docstring.

  19. rbtools/api/transport/sync.py (Diff revision 10)
     
     

    This needs a method docstring.

  20. rbtools/api/transport/sync.py (Diff revision 10)
     
     

    Please use single quotes instead of double.

  21. rbtools/api/transport/sync.py (Diff revision 10)
     
     

    This needs a method docstring.

  22. rbtools/api/transport/sync.py (Diff revision 10)
     
     

    This needs a method docstring.

  23. rbtools/api/transport/sync.py (Diff revision 10)
     
     
     
     
     
     

    Might be nice to have a helper for this too.

  24. rbtools/api/transport/sync.py (Diff revision 10)
     
     

    Please use single quotes instead of double.

  25. rbtools/api/transport/sync.py (Diff revision 10)
     
     

    This needs a method docstring.

  26. rbtools/api/transport/sync.py (Diff revision 10)
     
     

    KeyError?

  27. rbtools/api/transport/sync.py (Diff revision 10)
     
     

    Please use single quotes instead of double.

  28. rbtools/api/transport/sync.py (Diff revision 10)
     
     

    This needs a method docstring.

  29. rbtools/api/transport/sync.py (Diff revision 10)
     
     

    This needs a method docstring.

  30. rbtools/api/transport/sync.py (Diff revision 10)
     
     
     
     
     
     

    Please revert these changes--it's just churn in blank lines for no purpose.

    1. Sorry about this, I was doing a lot of print statements around here and forgot to restore the spaces.

  31. rbtools/api/transport/sync.py (Diff revision 10)
     
     
     
     

    Same here--move the blank line back, please.

  32. rbtools/commands/__init__.py (Diff revision 10)
     
     

    Please revert the changes in this file.

  33. rbtools/commands/api.py (Diff revision 10)
     
     

    This needs a module docstring.

  34. rbtools/commands/api.py (Diff revision 10)
     
     

    This needs a class docstring.

  35. rbtools/commands/api.py (Diff revision 10)
     
     
     

    How about "Perform Review Board API requests"?

    Note also that when we wrap a string, we put the space at the end of the first line instead of the beginning of the second. Your way is probably less error-prone but all of existing code that does it the other way.

  36. rbtools/commands/api.py (Diff revision 10)
     
     
     

    Put the space at the end of the first line instead of beginning of the second.

  37. rbtools/commands/api.py (Diff revision 10)
     
     
     

    Please swap the use of single and double quotes here.

  38. rbtools/commands/api.py (Diff revision 10)
     
     
     

    Swap single and double quotes here.

  39. rbtools/commands/api.py (Diff revision 10)
     
     

    This needs a method docstring.

  40. rbtools/commands/api.py (Diff revision 10)
     
     
     

    This first part needs to fit on a single line. Simply "Handle HTTP requests" is probably sufficient--the arguments are listed in the method definition and the docstring below.

  41. rbtools/commands/api.py (Diff revision 10)
     
     
     
     
     

    This should probably mention that it prints output.

    Alternatively, this method could just return the request and the caller could print.

  42. rbtools/commands/api.py (Diff revision 10)
     
     

    There's an extra blank line here.

  43. rbtools/commands/api.py (Diff revision 10)
     
     

    This blank line can be removed.

  44. rbtools/commands/api.py (Diff revision 10)
     
     

    Please use single quotes.

  45. rbtools/commands/api.py (Diff revision 10)
     
     

    Please use single quotes.

  46. rbtools/commands/api.py (Diff revision 10)
     
     

    Please use single quotes.

  47. rbtools/commands/api.py (Diff revision 10)
     
     
     

    Please use single quotes. This should also wrap with each entry on its own line. We could even avoid defining the variable and just put it inline:

    full_file_list.append({
        'filename': file_name,
        'content': content,
    })
    
  48. rbtools/commands/api.py (Diff revision 10)
     
     

    This needs a docstring.

  49. rbtools/commands/api.py (Diff revision 10)
     
     
     

    Add a blank line between these two.

  50. rbtools/commands/api.py (Diff revision 10)
     
     
     

    This should probably print an error (probably different errors depending on if no method was passed, or if multiple methods were passed)

  51. rbtools/commands/api_get.py (Diff revision 10)
     
     

    This should be reverted.

  52. rbtools/commands/main.py (Diff revision 10)
     
     

    Please revert the changes to this file.

  53. rbtools/utils/filesystem.py (Diff revision 10)
     
     

    Please revert the changes to this file.

  54. 
      
qianxi
Review request changed

Commits:

Summary ID
Merge XDG project changes in local branch into local master
13e4b1d3a98ebb31a701b4c80c457da035d050c0
[WIP]Add a new command called "api". Add option commands called "--get", "--post", "--delete". "api --get" option can substitute original "api-get" option now.
f5d08321dbf89a392a282e30b1cc4eba4f0d406e
[WIP]Add api.py file, forget to stage this file in the last commit.
39de827276ea422dea3fc1f630d35c17f415ab9c
[WIP]Add "--put" option but still need to find out how to send post/put data. Add "--header" option, still need to find a way to combine our customized header with original data.
9300eb1518e3b078f03aeb388b7f91821e915c7f
Refactor methods in api class. Now support use --header option to add customized header in a request.
604bed2b22deb3145dcf7339753bd2096d9d8889
[WIP]Allow basic HTTP GET, DELETE. Allow POST and PUT key value pairs. Still need further testings
f12ccfbf6346c75a934fdf6e70ee37c6e5c38702
Remove redundant print statements from api-get.py
dc104eaacfc259f3466e0c0cf14982ccc21da57e
Fix coding style problems.
dc4fcf3ccc29f5d6ab8243ade250c9ff830730e9
Fix more coding style problems.
027ac7cc1ef765176d3c8a98c8fa09e9295a4378
Add a newline character.
3058676f474918449c806faea1fe1787e168e659
Change create create_cookie_jar function. Edit test_create_cookie_jar. Fix coding style problems. Change improper variable names.
44efa2f7a4d647cba179c40223fa31685614cd15
Api testing
e5c49dad1d97276dbe9e4a21edb136e7984ee54e
Test "--post" and "--put" options.
53939217e08588c88d4a410bab2b4337e8ebcfd8
Revert "Change create create_cookie_jar function. Edit test_create_cookie_jar. Fix coding style problems. Change improper variable names."
This reverts commit 44efa2f7a4d647cba179c40223fa31685614cd15.
5068e0c14b5c564f8917f221100b9b6fc084f563
Revert "Merge XDG project changes in local branch into local master"
This reverts commit 13e4b1d3a98ebb31a701b4c80c457da035d050c0.
d3baaf085443b05301478c034acc24631dfedd2b
Fix coding style problems.
921d578ffcec441f0047bc4f4c4fc8cd3c74673c
Add "--patch" and "--file" options. Finish testing "--post", "--put", "--get", "--delete", "--pretty" and "--header" options.
e5529638e506d696280d0f28377f017729fe53a3
Fix coding style problems.
41fca77f0fcf26e86c9cef616e2e9ab8ce7dd371
Fix file upload problem.
8b092c2d0797f6f2f367d0a27d163dff221f0076
Fix redundant variable problem.
122e4a928f1513907dd14ca73289f08f33066f24
Merge XDG project changes in local branch into local master
13e4b1d3a98ebb31a701b4c80c457da035d050c0
[WIP]Add a new command called "api". Add option commands called "--get", "--post", "--delete". "api --get" option can substitute original "api-get" option now.
f5d08321dbf89a392a282e30b1cc4eba4f0d406e
[WIP]Add api.py file, forget to stage this file in the last commit.
39de827276ea422dea3fc1f630d35c17f415ab9c
[WIP]Add "--put" option but still need to find out how to send post/put data. Add "--header" option, still need to find a way to combine our customized header with original data.
9300eb1518e3b078f03aeb388b7f91821e915c7f
Refactor methods in api class. Now support use --header option to add customized header in a request.
604bed2b22deb3145dcf7339753bd2096d9d8889
[WIP]Allow basic HTTP GET, DELETE. Allow POST and PUT key value pairs. Still need further testings
f12ccfbf6346c75a934fdf6e70ee37c6e5c38702
Remove redundant print statements from api-get.py
dc104eaacfc259f3466e0c0cf14982ccc21da57e
Fix coding style problems.
dc4fcf3ccc29f5d6ab8243ade250c9ff830730e9
Fix more coding style problems.
027ac7cc1ef765176d3c8a98c8fa09e9295a4378
Add a newline character.
3058676f474918449c806faea1fe1787e168e659
Change create create_cookie_jar function. Edit test_create_cookie_jar. Fix coding style problems. Change improper variable names.
44efa2f7a4d647cba179c40223fa31685614cd15
Api testing
e5c49dad1d97276dbe9e4a21edb136e7984ee54e
Test "--post" and "--put" options.
53939217e08588c88d4a410bab2b4337e8ebcfd8
Revert "Change create create_cookie_jar function. Edit test_create_cookie_jar. Fix coding style problems. Change improper variable names."
This reverts commit 44efa2f7a4d647cba179c40223fa31685614cd15.
5068e0c14b5c564f8917f221100b9b6fc084f563
Revert "Merge XDG project changes in local branch into local master"
This reverts commit 13e4b1d3a98ebb31a701b4c80c457da035d050c0.
d3baaf085443b05301478c034acc24631dfedd2b
Fix coding style problems.
921d578ffcec441f0047bc4f4c4fc8cd3c74673c
Add "--patch" and "--file" options. Finish testing "--post", "--put", "--get", "--delete", "--pretty" and "--header" options.
e5529638e506d696280d0f28377f017729fe53a3
Fix coding style problems.
41fca77f0fcf26e86c9cef616e2e9ab8ce7dd371
Fix file upload problem.
8b092c2d0797f6f2f367d0a27d163dff221f0076
Fix redundant variable problem.
122e4a928f1513907dd14ca73289f08f33066f24
Fix coding style problems. Add method docs. Add method helpers.
ca8f74f465f3ac16e3909f626ea649e3b8efd9b3

Diff:

Revision 11 (+2649 -759)

Show changes

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

qianxi
qianxi
qianxi
chipx86
  1. 
      
  2. rbtools/api/transport/sync.py (Diff revision 14)
     
     
     
     
     
     
     

    This isn't ultimately useful to have here in our codebase. It's a great thing to learn! But these imports are present in every single file in all of our codebases, so we don't want to document it in each file.

  3. rbtools/api/transport/sync.py (Diff revision 14)
     
     

    Can you rename this to _get_padded_url? That's a better fit for the naming we aim for. We want to communicate that this gets (returns) something, and that the thing it's returning is a padded URL.

  4. rbtools/api/transport/sync.py (Diff revision 14)
     
     

    Likewise, this would be better as "Returns a URL ending with a slash."

    ("URL" should always be capitalized.)

  5. rbtools/api/transport/sync.py (Diff revision 14)
     
     
     

    For "Returns", the description text can't be indented. We do indent for "Args," because we're have a list of arguments. "Returns" doesn't work this way, and this will ultimately render incorrectly.

  6. rbtools/api/transport/sync.py (Diff revision 14)
     
     

    "The URL or path ending with a '/'." would be better.

  7. rbtools/api/transport/sync.py (Diff revision 14)
     
     
     
     
     
     
     

    We can probably simplify this:

    if not url.ensdwith('/'):
        url = '%s/' % url
    
    return url
    

    Avoids the creation of a new variable.

    %-based formatting is also generally faster (Python compiles it down to bytecode)

  8. rbtools/api/transport/sync.py (Diff revision 14)
     
     
     

    You can probably replace this with Python's urljoin function.

  9. rbtools/api/transport/sync.py (Diff revision 14)
     
     
     

    No indentation for descriptions in "Returns".

    This will apply to any others throughout this change.

  10. rbtools/api/transport/sync.py (Diff revision 14)
     
     
     

    Is this for querystrings? If so, check out Python's parse_qsl function.

    Look at HttpRequest in RBTools for code already doing this.

  11. rbtools/api/transport/sync.py (Diff revision 14)
     
     
     
     
     

    The naming may seem unrelated, but this is actually already available to us in Python's email module as email.message_from_string. This is used under-the-hood for Python's own HTTP header parsing, as it's the same standard.

    You can do something like this (I'm copying from the Python shell):

    >>> import email
    >>> dict(email.message_from_string(
    ...     'User-Agent: foo\n'
    ...     'Content-Type: bar\n'
    ...     'X-Custom: foobar!')
    {'X-Custom': 'foobar!', 'Content-Type': 'bar', 'User-Agent': 'foo'}
    
  12. rbtools/api/transport/sync.py (Diff revision 14)
     
     

    Should always be capitalized as "URL".

    Same elsewhere in the change.

  13. rbtools/api/transport/sync.py (Diff revision 14)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     

    Repeating ourselves for each method can end up increasing our maintenance burden. Instead, since these are all wrapping a centralized function, it's probably best to just document it there and instead refer readers to that in args.

    However, it's not quite right to pass in a dictionary as an argument and have that contain what's effectively keyword arguments. It would be better to make each of these things a new keyword argument.

    Same goes for all other functions doing this.

  14. rbtools/api/transport/sync.py (Diff revision 14)
     
     

    Instead of dict.items(), we need to do six.iteritems(dict) to get consistent behavior across Python 2 and 3.

    Same anywhere else this may be done.

  15. rbtools/api/transport/sync.py (Diff revision 14)
     
     

    All these _path versions of these functions seem to have the same logic as the _url versions, but are creating an absolute URL.

    How about just keeping the _path versions simple. have them call the _url version, but with the absolute URL (through urljoin).

  16. rbtools/commands/__init__.py (Diff revision 14)
     
     
     
     

    All these blank lines need to remain.

  17. rbtools/commands/api.py (Diff revision 14)
     
     
     
     
     
     
     
     
     

    This should be removed, for the same reason above.

  18. rbtools/commands/api.py (Diff revision 14)
     
     

    rbt api --post

    Other examples are also missing the api bit.

  19. rbtools/commands/api.py (Diff revision 14)
     
     

    I think we shouldn't say too much more than "Send a HTTP PATCH request to an API" (and same for other HTTP methods).

  20. rbtools/commands/api.py (Diff revision 14)
     
     

    All private functions should follow public functions.

  21. rbtools/commands/api.py (Diff revision 14)
     
     
     

    You probably want a blank line here.

  22. rbtools/commands/api.py (Diff revision 14)
     
     

    self.options.pretty_print is a reference to internal code. Write these docs like nobody's reading your code. You probably want to say something like:

    If the :option:`--pretty` option is passed to the command, ...
    
  23. rbtools/commands/api.py (Diff revision 14)
     
     
     

    This is missing a return type.

    We're also not streaming to anything. We're just returning a string.

  24. rbtools/commands/api.py (Diff revision 14)
     
     

    Comma should be on the prior line.

  25. rbtools/commands/api.py (Diff revision 14)
     
     
  26. rbtools/commands/api.py (Diff revision 14)
     
     
     
     
     

    You want a blank line before the statement and the loop, but not on the first inner line of the loop.

  27. rbtools/commands/api.py (Diff revision 14)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     

    This can be simplified massively by doing a couple things:

    1. Have each HTTP method option (--get, --post, etc.) have an action of store_const, setting a central attribute (say, 'http_method') to a value (get, post, etc.).

    2. Update this code to compute the correct function to call:

    http_method = self.options.http_method
    
    if path.startswith(...):
        client_method_name = '%s_url' % http_method
    else:
        client_method_name = '%s_path' % http_method
    
    client_method = getattr(api_client, http_method_name)
    assert client_method is not None
    
    resource = client_method(...)
    
  28. rbtools/commands/api.py (Diff revision 14)
     
     

    startswith takes a tuple, for convenience:

    if path.startswith(('http://', 'https://')):
    
  29. rbtools/commands/api.py (Diff revision 14)
     
     

    This will need to be the full import class path.

  30. rbtools/commands/api.py (Diff revision 14)
     
     

    I think we want to avoid allowing anything unexpected to be a query argument. What if an API takes a query argument of ?get=...?

    The old code did this, but it was a bad idea.

    Let's instead add a --query parameter, or allow it on the URL itself.

  31. rbtools/commands/api.py (Diff revision 14)
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     

    The above recommendation about the HTTP method options will eliminate all of this.

    Now, that doesn't mean that it'll duplicate this behavior. The way it'll work is that the last of --get, --post, etc. specified wins. That isn't ideal, but it's frankly good enough.

    If we really want to protect the user here, the right solution would be to make a new action that gets passed to options, and have it warn at that time, before we do all this work.

  32. 
      
qianxi
Review request changed

Commits:

Summary ID
Merge XDG project changes in local branch into local master
13e4b1d3a98ebb31a701b4c80c457da035d050c0
[WIP]Add a new command called "api". Add option commands called "--get", "--post", "--delete". "api --get" option can substitute original "api-get" option now.
f5d08321dbf89a392a282e30b1cc4eba4f0d406e
[WIP]Add api.py file, forget to stage this file in the last commit.
39de827276ea422dea3fc1f630d35c17f415ab9c
[WIP]Add "--put" option but still need to find out how to send post/put data. Add "--header" option, still need to find a way to combine our customized header with original data.
9300eb1518e3b078f03aeb388b7f91821e915c7f
Refactor methods in api class. Now support use --header option to add customized header in a request.
604bed2b22deb3145dcf7339753bd2096d9d8889
[WIP]Allow basic HTTP GET, DELETE. Allow POST and PUT key value pairs. Still need further testings
f12ccfbf6346c75a934fdf6e70ee37c6e5c38702
Remove redundant print statements from api-get.py
dc104eaacfc259f3466e0c0cf14982ccc21da57e
Fix coding style problems.
dc4fcf3ccc29f5d6ab8243ade250c9ff830730e9
Fix more coding style problems.
027ac7cc1ef765176d3c8a98c8fa09e9295a4378
Add a newline character.
3058676f474918449c806faea1fe1787e168e659
Change create create_cookie_jar function. Edit test_create_cookie_jar. Fix coding style problems. Change improper variable names.
44efa2f7a4d647cba179c40223fa31685614cd15
Api testing
e5c49dad1d97276dbe9e4a21edb136e7984ee54e
Test "--post" and "--put" options.
53939217e08588c88d4a410bab2b4337e8ebcfd8
Revert "Change create create_cookie_jar function. Edit test_create_cookie_jar. Fix coding style problems. Change improper variable names."
This reverts commit 44efa2f7a4d647cba179c40223fa31685614cd15.
5068e0c14b5c564f8917f221100b9b6fc084f563
Revert "Merge XDG project changes in local branch into local master"
This reverts commit 13e4b1d3a98ebb31a701b4c80c457da035d050c0.
d3baaf085443b05301478c034acc24631dfedd2b
Fix coding style problems.
921d578ffcec441f0047bc4f4c4fc8cd3c74673c
Add "--patch" and "--file" options. Finish testing "--post", "--put", "--get", "--delete", "--pretty" and "--header" options.
e5529638e506d696280d0f28377f017729fe53a3
Fix coding style problems.
41fca77f0fcf26e86c9cef616e2e9ab8ce7dd371
Fix file upload problem.
8b092c2d0797f6f2f367d0a27d163dff221f0076
Fix redundant variable problem.
122e4a928f1513907dd14ca73289f08f33066f24
Fix coding style problems. Add method docs. Add method helpers.
ca8f74f465f3ac16e3909f626ea649e3b8efd9b3
Fix coding style problems.
232ae21dc68075b4259ced72f86563e006f007cd
Remove .DS_Store file.
83d5cbb5a8c9b8c0bba6a2dfaa3660afb84a4abd
Add __future__ module doc string.
187b2ab7edcefd834a8c8da1cf62e03704c1605b
Merge XDG project changes in local branch into local master
13e4b1d3a98ebb31a701b4c80c457da035d050c0
[WIP]Add a new command called "api". Add option commands called "--get", "--post", "--delete". "api --get" option can substitute original "api-get" option now.
f5d08321dbf89a392a282e30b1cc4eba4f0d406e
[WIP]Add api.py file, forget to stage this file in the last commit.
39de827276ea422dea3fc1f630d35c17f415ab9c
[WIP]Add "--put" option but still need to find out how to send post/put data. Add "--header" option, still need to find a way to combine our customized header with original data.
9300eb1518e3b078f03aeb388b7f91821e915c7f
Refactor methods in api class. Now support use --header option to add customized header in a request.
604bed2b22deb3145dcf7339753bd2096d9d8889
[WIP]Allow basic HTTP GET, DELETE. Allow POST and PUT key value pairs. Still need further testings
f12ccfbf6346c75a934fdf6e70ee37c6e5c38702
Remove redundant print statements from api-get.py
dc104eaacfc259f3466e0c0cf14982ccc21da57e
Fix coding style problems.
dc4fcf3ccc29f5d6ab8243ade250c9ff830730e9
Fix more coding style problems.
027ac7cc1ef765176d3c8a98c8fa09e9295a4378
Add a newline character.
3058676f474918449c806faea1fe1787e168e659
Change create create_cookie_jar function. Edit test_create_cookie_jar. Fix coding style problems. Change improper variable names.
44efa2f7a4d647cba179c40223fa31685614cd15
Api testing
e5c49dad1d97276dbe9e4a21edb136e7984ee54e
Test "--post" and "--put" options.
53939217e08588c88d4a410bab2b4337e8ebcfd8
Revert "Change create create_cookie_jar function. Edit test_create_cookie_jar. Fix coding style problems. Change improper variable names."
This reverts commit 44efa2f7a4d647cba179c40223fa31685614cd15.
5068e0c14b5c564f8917f221100b9b6fc084f563
Revert "Merge XDG project changes in local branch into local master"
This reverts commit 13e4b1d3a98ebb31a701b4c80c457da035d050c0.
d3baaf085443b05301478c034acc24631dfedd2b
Fix coding style problems.
921d578ffcec441f0047bc4f4c4fc8cd3c74673c
Add "--patch" and "--file" options. Finish testing "--post", "--put", "--get", "--delete", "--pretty" and "--header" options.
e5529638e506d696280d0f28377f017729fe53a3
Fix coding style problems.
41fca77f0fcf26e86c9cef616e2e9ab8ce7dd371
Fix file upload problem.
8b092c2d0797f6f2f367d0a27d163dff221f0076
Fix redundant variable problem.
122e4a928f1513907dd14ca73289f08f33066f24
Fix coding style problems. Add method docs. Add method helpers.
ca8f74f465f3ac16e3909f626ea649e3b8efd9b3
Fix coding style problems.
232ae21dc68075b4259ced72f86563e006f007cd
Remove .DS_Store file.
83d5cbb5a8c9b8c0bba6a2dfaa3660afb84a4abd
Add __future__ module doc string.
187b2ab7edcefd834a8c8da1cf62e03704c1605b
Refactor code. Fix improper usage of variables.
aa3ebd0cc4f78e6fb887d7d7aedc30ab1e5b464f

Diff:

Revision 15 (+2691 -1491)

Show changes

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

qianxi
Review request changed

Commits:

Summary ID
Merge XDG project changes in local branch into local master
13e4b1d3a98ebb31a701b4c80c457da035d050c0
[WIP]Add a new command called "api". Add option commands called "--get", "--post", "--delete". "api --get" option can substitute original "api-get" option now.
f5d08321dbf89a392a282e30b1cc4eba4f0d406e
[WIP]Add api.py file, forget to stage this file in the last commit.
39de827276ea422dea3fc1f630d35c17f415ab9c
[WIP]Add "--put" option but still need to find out how to send post/put data. Add "--header" option, still need to find a way to combine our customized header with original data.
9300eb1518e3b078f03aeb388b7f91821e915c7f
Refactor methods in api class. Now support use --header option to add customized header in a request.
604bed2b22deb3145dcf7339753bd2096d9d8889
[WIP]Allow basic HTTP GET, DELETE. Allow POST and PUT key value pairs. Still need further testings
f12ccfbf6346c75a934fdf6e70ee37c6e5c38702
Remove redundant print statements from api-get.py
dc104eaacfc259f3466e0c0cf14982ccc21da57e
Fix coding style problems.
dc4fcf3ccc29f5d6ab8243ade250c9ff830730e9
Fix more coding style problems.
027ac7cc1ef765176d3c8a98c8fa09e9295a4378
Add a newline character.
3058676f474918449c806faea1fe1787e168e659
Change create create_cookie_jar function. Edit test_create_cookie_jar. Fix coding style problems. Change improper variable names.
44efa2f7a4d647cba179c40223fa31685614cd15
Api testing
e5c49dad1d97276dbe9e4a21edb136e7984ee54e
Test "--post" and "--put" options.
53939217e08588c88d4a410bab2b4337e8ebcfd8
Revert "Change create create_cookie_jar function. Edit test_create_cookie_jar. Fix coding style problems. Change improper variable names."
This reverts commit 44efa2f7a4d647cba179c40223fa31685614cd15.
5068e0c14b5c564f8917f221100b9b6fc084f563
Revert "Merge XDG project changes in local branch into local master"
This reverts commit 13e4b1d3a98ebb31a701b4c80c457da035d050c0.
d3baaf085443b05301478c034acc24631dfedd2b
Fix coding style problems.
921d578ffcec441f0047bc4f4c4fc8cd3c74673c
Add "--patch" and "--file" options. Finish testing "--post", "--put", "--get", "--delete", "--pretty" and "--header" options.
e5529638e506d696280d0f28377f017729fe53a3
Fix coding style problems.
41fca77f0fcf26e86c9cef616e2e9ab8ce7dd371
Fix file upload problem.
8b092c2d0797f6f2f367d0a27d163dff221f0076
Fix redundant variable problem.
122e4a928f1513907dd14ca73289f08f33066f24
Fix coding style problems. Add method docs. Add method helpers.
ca8f74f465f3ac16e3909f626ea649e3b8efd9b3
Fix coding style problems.
232ae21dc68075b4259ced72f86563e006f007cd
Remove .DS_Store file.
83d5cbb5a8c9b8c0bba6a2dfaa3660afb84a4abd
Add __future__ module doc string.
187b2ab7edcefd834a8c8da1cf62e03704c1605b
Refactor code. Fix improper usage of variables.
aa3ebd0cc4f78e6fb887d7d7aedc30ab1e5b464f
Merge XDG project changes in local branch into local master
13e4b1d3a98ebb31a701b4c80c457da035d050c0
[WIP]Add a new command called "api". Add option commands called "--get", "--post", "--delete". "api --get" option can substitute original "api-get" option now.
f5d08321dbf89a392a282e30b1cc4eba4f0d406e
[WIP]Add api.py file, forget to stage this file in the last commit.
39de827276ea422dea3fc1f630d35c17f415ab9c
[WIP]Add "--put" option but still need to find out how to send post/put data. Add "--header" option, still need to find a way to combine our customized header with original data.
9300eb1518e3b078f03aeb388b7f91821e915c7f
Refactor methods in api class. Now support use --header option to add customized header in a request.
604bed2b22deb3145dcf7339753bd2096d9d8889
[WIP]Allow basic HTTP GET, DELETE. Allow POST and PUT key value pairs. Still need further testings
f12ccfbf6346c75a934fdf6e70ee37c6e5c38702
Remove redundant print statements from api-get.py
dc104eaacfc259f3466e0c0cf14982ccc21da57e
Fix coding style problems.
dc4fcf3ccc29f5d6ab8243ade250c9ff830730e9
Fix more coding style problems.
027ac7cc1ef765176d3c8a98c8fa09e9295a4378
Add a newline character.
3058676f474918449c806faea1fe1787e168e659
Change create create_cookie_jar function. Edit test_create_cookie_jar. Fix coding style problems. Change improper variable names.
44efa2f7a4d647cba179c40223fa31685614cd15
Api testing
e5c49dad1d97276dbe9e4a21edb136e7984ee54e
Test "--post" and "--put" options.
53939217e08588c88d4a410bab2b4337e8ebcfd8
Revert "Change create create_cookie_jar function. Edit test_create_cookie_jar. Fix coding style problems. Change improper variable names."
This reverts commit 44efa2f7a4d647cba179c40223fa31685614cd15.
5068e0c14b5c564f8917f221100b9b6fc084f563
Revert "Merge XDG project changes in local branch into local master"
This reverts commit 13e4b1d3a98ebb31a701b4c80c457da035d050c0.
d3baaf085443b05301478c034acc24631dfedd2b
Fix coding style problems.
921d578ffcec441f0047bc4f4c4fc8cd3c74673c
Add "--patch" and "--file" options. Finish testing "--post", "--put", "--get", "--delete", "--pretty" and "--header" options.
e5529638e506d696280d0f28377f017729fe53a3
Fix coding style problems.
41fca77f0fcf26e86c9cef616e2e9ab8ce7dd371
Fix file upload problem.
8b092c2d0797f6f2f367d0a27d163dff221f0076
Fix redundant variable problem.
122e4a928f1513907dd14ca73289f08f33066f24
Fix coding style problems. Add method docs. Add method helpers.
ca8f74f465f3ac16e3909f626ea649e3b8efd9b3
Fix coding style problems.
232ae21dc68075b4259ced72f86563e006f007cd
Remove .DS_Store file.
83d5cbb5a8c9b8c0bba6a2dfaa3660afb84a4abd
Add __future__ module doc string.
187b2ab7edcefd834a8c8da1cf62e03704c1605b
Refactor code. Fix improper usage of variables.
aa3ebd0cc4f78e6fb887d7d7aedc30ab1e5b464f
Fix coding style problems.
dc68ac243b80d790d14d519b582e161fe371f941

Diff:

Revision 16 (+2753 -1563)

Show changes

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

qianxi
Review request changed

Commits:

Summary ID
Merge XDG project changes in local branch into local master
13e4b1d3a98ebb31a701b4c80c457da035d050c0
[WIP]Add a new command called "api". Add option commands called "--get", "--post", "--delete". "api --get" option can substitute original "api-get" option now.
f5d08321dbf89a392a282e30b1cc4eba4f0d406e
[WIP]Add api.py file, forget to stage this file in the last commit.
39de827276ea422dea3fc1f630d35c17f415ab9c
[WIP]Add "--put" option but still need to find out how to send post/put data. Add "--header" option, still need to find a way to combine our customized header with original data.
9300eb1518e3b078f03aeb388b7f91821e915c7f
Refactor methods in api class. Now support use --header option to add customized header in a request.
604bed2b22deb3145dcf7339753bd2096d9d8889
[WIP]Allow basic HTTP GET, DELETE. Allow POST and PUT key value pairs. Still need further testings
f12ccfbf6346c75a934fdf6e70ee37c6e5c38702
Remove redundant print statements from api-get.py
dc104eaacfc259f3466e0c0cf14982ccc21da57e
Fix coding style problems.
dc4fcf3ccc29f5d6ab8243ade250c9ff830730e9
Fix more coding style problems.
027ac7cc1ef765176d3c8a98c8fa09e9295a4378
Add a newline character.
3058676f474918449c806faea1fe1787e168e659
Change create create_cookie_jar function. Edit test_create_cookie_jar. Fix coding style problems. Change improper variable names.
44efa2f7a4d647cba179c40223fa31685614cd15
Api testing
e5c49dad1d97276dbe9e4a21edb136e7984ee54e
Test "--post" and "--put" options.
53939217e08588c88d4a410bab2b4337e8ebcfd8
Revert "Change create create_cookie_jar function. Edit test_create_cookie_jar. Fix coding style problems. Change improper variable names."
This reverts commit 44efa2f7a4d647cba179c40223fa31685614cd15.
5068e0c14b5c564f8917f221100b9b6fc084f563
Revert "Merge XDG project changes in local branch into local master"
This reverts commit 13e4b1d3a98ebb31a701b4c80c457da035d050c0.
d3baaf085443b05301478c034acc24631dfedd2b
Fix coding style problems.
921d578ffcec441f0047bc4f4c4fc8cd3c74673c
Add "--patch" and "--file" options. Finish testing "--post", "--put", "--get", "--delete", "--pretty" and "--header" options.
e5529638e506d696280d0f28377f017729fe53a3
Fix coding style problems.
41fca77f0fcf26e86c9cef616e2e9ab8ce7dd371
Fix file upload problem.
8b092c2d0797f6f2f367d0a27d163dff221f0076
Fix redundant variable problem.
122e4a928f1513907dd14ca73289f08f33066f24
Fix coding style problems. Add method docs. Add method helpers.
ca8f74f465f3ac16e3909f626ea649e3b8efd9b3
Fix coding style problems.
232ae21dc68075b4259ced72f86563e006f007cd
Remove .DS_Store file.
83d5cbb5a8c9b8c0bba6a2dfaa3660afb84a4abd
Add __future__ module doc string.
187b2ab7edcefd834a8c8da1cf62e03704c1605b
Refactor code. Fix improper usage of variables.
aa3ebd0cc4f78e6fb887d7d7aedc30ab1e5b464f
Fix coding style problems.
dc68ac243b80d790d14d519b582e161fe371f941
Merge XDG project changes in local branch into local master
13e4b1d3a98ebb31a701b4c80c457da035d050c0
[WIP]Add a new command called "api". Add option commands called "--get", "--post", "--delete". "api --get" option can substitute original "api-get" option now.
f5d08321dbf89a392a282e30b1cc4eba4f0d406e
[WIP]Add api.py file, forget to stage this file in the last commit.
39de827276ea422dea3fc1f630d35c17f415ab9c
[WIP]Add "--put" option but still need to find out how to send post/put data. Add "--header" option, still need to find a way to combine our customized header with original data.
9300eb1518e3b078f03aeb388b7f91821e915c7f
Refactor methods in api class. Now support use --header option to add customized header in a request.
604bed2b22deb3145dcf7339753bd2096d9d8889
[WIP]Allow basic HTTP GET, DELETE. Allow POST and PUT key value pairs. Still need further testings
f12ccfbf6346c75a934fdf6e70ee37c6e5c38702
Remove redundant print statements from api-get.py
dc104eaacfc259f3466e0c0cf14982ccc21da57e
Fix coding style problems.
dc4fcf3ccc29f5d6ab8243ade250c9ff830730e9
Fix more coding style problems.
027ac7cc1ef765176d3c8a98c8fa09e9295a4378
Add a newline character.
3058676f474918449c806faea1fe1787e168e659
Change create create_cookie_jar function. Edit test_create_cookie_jar. Fix coding style problems. Change improper variable names.
44efa2f7a4d647cba179c40223fa31685614cd15
Api testing
e5c49dad1d97276dbe9e4a21edb136e7984ee54e
Test "--post" and "--put" options.
53939217e08588c88d4a410bab2b4337e8ebcfd8
Revert "Change create create_cookie_jar function. Edit test_create_cookie_jar. Fix coding style problems. Change improper variable names."
This reverts commit 44efa2f7a4d647cba179c40223fa31685614cd15.
5068e0c14b5c564f8917f221100b9b6fc084f563
Revert "Merge XDG project changes in local branch into local master"
This reverts commit 13e4b1d3a98ebb31a701b4c80c457da035d050c0.
d3baaf085443b05301478c034acc24631dfedd2b
Fix coding style problems.
921d578ffcec441f0047bc4f4c4fc8cd3c74673c
Add "--patch" and "--file" options. Finish testing "--post", "--put", "--get", "--delete", "--pretty" and "--header" options.
e5529638e506d696280d0f28377f017729fe53a3
Fix coding style problems.
41fca77f0fcf26e86c9cef616e2e9ab8ce7dd371
Fix file upload problem.
8b092c2d0797f6f2f367d0a27d163dff221f0076
Fix redundant variable problem.
122e4a928f1513907dd14ca73289f08f33066f24
Fix coding style problems. Add method docs. Add method helpers.
ca8f74f465f3ac16e3909f626ea649e3b8efd9b3
Fix coding style problems.
232ae21dc68075b4259ced72f86563e006f007cd
Remove .DS_Store file.
83d5cbb5a8c9b8c0bba6a2dfaa3660afb84a4abd
Add __future__ module doc string.
187b2ab7edcefd834a8c8da1cf62e03704c1605b
Refactor code. Fix improper usage of variables.
aa3ebd0cc4f78e6fb887d7d7aedc30ab1e5b464f
Fix coding style problems.
dc68ac243b80d790d14d519b582e161fe371f941
Fix coding style problems.
b8a14bb190c4e8f99bb37d71eaa8a2161149c501

Diff:

Revision 17 (+2768 -1572)

Show changes

Checks run (1 failed, 1 succeeded)

flake8 failed.
JSHint passed.

flake8

qianxi
Review request changed

Commits:

Summary ID
Merge XDG project changes in local branch into local master
13e4b1d3a98ebb31a701b4c80c457da035d050c0
[WIP]Add a new command called "api". Add option commands called "--get", "--post", "--delete". "api --get" option can substitute original "api-get" option now.
f5d08321dbf89a392a282e30b1cc4eba4f0d406e
[WIP]Add api.py file, forget to stage this file in the last commit.
39de827276ea422dea3fc1f630d35c17f415ab9c
[WIP]Add "--put" option but still need to find out how to send post/put data. Add "--header" option, still need to find a way to combine our customized header with original data.
9300eb1518e3b078f03aeb388b7f91821e915c7f
Refactor methods in api class. Now support use --header option to add customized header in a request.
604bed2b22deb3145dcf7339753bd2096d9d8889
[WIP]Allow basic HTTP GET, DELETE. Allow POST and PUT key value pairs. Still need further testings
f12ccfbf6346c75a934fdf6e70ee37c6e5c38702
Remove redundant print statements from api-get.py
dc104eaacfc259f3466e0c0cf14982ccc21da57e
Fix coding style problems.
dc4fcf3ccc29f5d6ab8243ade250c9ff830730e9
Fix more coding style problems.
027ac7cc1ef765176d3c8a98c8fa09e9295a4378
Add a newline character.
3058676f474918449c806faea1fe1787e168e659
Change create create_cookie_jar function. Edit test_create_cookie_jar. Fix coding style problems. Change improper variable names.
44efa2f7a4d647cba179c40223fa31685614cd15
Api testing
e5c49dad1d97276dbe9e4a21edb136e7984ee54e
Test "--post" and "--put" options.
53939217e08588c88d4a410bab2b4337e8ebcfd8
Revert "Change create create_cookie_jar function. Edit test_create_cookie_jar. Fix coding style problems. Change improper variable names."
This reverts commit 44efa2f7a4d647cba179c40223fa31685614cd15.
5068e0c14b5c564f8917f221100b9b6fc084f563
Revert "Merge XDG project changes in local branch into local master"
This reverts commit 13e4b1d3a98ebb31a701b4c80c457da035d050c0.
d3baaf085443b05301478c034acc24631dfedd2b
Fix coding style problems.
921d578ffcec441f0047bc4f4c4fc8cd3c74673c
Add "--patch" and "--file" options. Finish testing "--post", "--put", "--get", "--delete", "--pretty" and "--header" options.
e5529638e506d696280d0f28377f017729fe53a3
Fix coding style problems.
41fca77f0fcf26e86c9cef616e2e9ab8ce7dd371
Fix file upload problem.
8b092c2d0797f6f2f367d0a27d163dff221f0076
Fix redundant variable problem.
122e4a928f1513907dd14ca73289f08f33066f24
Fix coding style problems. Add method docs. Add method helpers.
ca8f74f465f3ac16e3909f626ea649e3b8efd9b3
Fix coding style problems.
232ae21dc68075b4259ced72f86563e006f007cd
Remove .DS_Store file.
83d5cbb5a8c9b8c0bba6a2dfaa3660afb84a4abd
Add __future__ module doc string.
187b2ab7edcefd834a8c8da1cf62e03704c1605b
Refactor code. Fix improper usage of variables.
aa3ebd0cc4f78e6fb887d7d7aedc30ab1e5b464f
Fix coding style problems.
dc68ac243b80d790d14d519b582e161fe371f941
Fix coding style problems.
b8a14bb190c4e8f99bb37d71eaa8a2161149c501
Merge XDG project changes in local branch into local master
13e4b1d3a98ebb31a701b4c80c457da035d050c0
[WIP]Add a new command called "api". Add option commands called "--get", "--post", "--delete". "api --get" option can substitute original "api-get" option now.
f5d08321dbf89a392a282e30b1cc4eba4f0d406e
[WIP]Add api.py file, forget to stage this file in the last commit.
39de827276ea422dea3fc1f630d35c17f415ab9c
[WIP]Add "--put" option but still need to find out how to send post/put data. Add "--header" option, still need to find a way to combine our customized header with original data.
9300eb1518e3b078f03aeb388b7f91821e915c7f
Refactor methods in api class. Now support use --header option to add customized header in a request.
604bed2b22deb3145dcf7339753bd2096d9d8889
[WIP]Allow basic HTTP GET, DELETE. Allow POST and PUT key value pairs. Still need further testings
f12ccfbf6346c75a934fdf6e70ee37c6e5c38702
Remove redundant print statements from api-get.py
dc104eaacfc259f3466e0c0cf14982ccc21da57e
Fix coding style problems.
dc4fcf3ccc29f5d6ab8243ade250c9ff830730e9
Fix more coding style problems.
027ac7cc1ef765176d3c8a98c8fa09e9295a4378
Add a newline character.
3058676f474918449c806faea1fe1787e168e659
Change create create_cookie_jar function. Edit test_create_cookie_jar. Fix coding style problems. Change improper variable names.
44efa2f7a4d647cba179c40223fa31685614cd15
Api testing
e5c49dad1d97276dbe9e4a21edb136e7984ee54e
Test "--post" and "--put" options.
53939217e08588c88d4a410bab2b4337e8ebcfd8
Revert "Change create create_cookie_jar function. Edit test_create_cookie_jar. Fix coding style problems. Change improper variable names."
This reverts commit 44efa2f7a4d647cba179c40223fa31685614cd15.
5068e0c14b5c564f8917f221100b9b6fc084f563
Revert "Merge XDG project changes in local branch into local master"
This reverts commit 13e4b1d3a98ebb31a701b4c80c457da035d050c0.
d3baaf085443b05301478c034acc24631dfedd2b
Fix coding style problems.
921d578ffcec441f0047bc4f4c4fc8cd3c74673c
Add "--patch" and "--file" options. Finish testing "--post", "--put", "--get", "--delete", "--pretty" and "--header" options.
e5529638e506d696280d0f28377f017729fe53a3
Fix coding style problems.
41fca77f0fcf26e86c9cef616e2e9ab8ce7dd371
Fix file upload problem.
8b092c2d0797f6f2f367d0a27d163dff221f0076
Fix redundant variable problem.
122e4a928f1513907dd14ca73289f08f33066f24
Fix coding style problems. Add method docs. Add method helpers.
ca8f74f465f3ac16e3909f626ea649e3b8efd9b3
Fix coding style problems.
232ae21dc68075b4259ced72f86563e006f007cd
Remove .DS_Store file.
83d5cbb5a8c9b8c0bba6a2dfaa3660afb84a4abd
Add __future__ module doc string.
187b2ab7edcefd834a8c8da1cf62e03704c1605b
Refactor code. Fix improper usage of variables.
aa3ebd0cc4f78e6fb887d7d7aedc30ab1e5b464f
Fix coding style problems.
dc68ac243b80d790d14d519b582e161fe371f941
Fix coding style problems.
b8a14bb190c4e8f99bb37d71eaa8a2161149c501
Fix trailing space problems.
5b9e1d3306d68e41892698b96c063439efaa9c49

Diff:

Revision 18 (+2771 -1575)

Show changes

Checks run (2 succeeded)

flake8 passed.
JSHint passed.
Loading...